Docker Compose
Drupal Development Environments with Docker Compose
Me
- mccrodp on d.org
- Work for X-Team
- Pantheon.io; Website Management Tools
- Programs: Unleash; Dojo, etc.
- Want a job? - msg me
- Me - Drupal Dev since ~D6 (2008) - mccrodp on d.org
- 100% remote dev company (Symfony, Laravel, React, etc)
- My work: Drupal 7 - Pantheon.io; marketing site
- Unleash; upskilling and community work weekly, Dojo: mentoring
- A job that allows you to travel
What is this talk about?
- How? complex dev environments...
- What? Vagrant; Puppet, Chef, Ansible...etc.
- Confused! I’m not an admin...
- Boring! Waste of time.
- Enter Docker :)
- Boring! I just need to develop this website / software!
What is Docker?
- An open platform for distributed applications for developers and sysadmins
- Agility
- Control
- Portability
- Accurately define environments
- Developers own all code (incl. OS-kinda)
- Deploy full docker container, e.g. to AWS
- What are Docker containers?
Benefits of Docker!
Dev
- Accelerate
- Eliminate
- Collaborate
Deploy
- Ship Frequently
- Scale easily
- Accelerate Developer Onboarding
- Eliminate Environment Inconsistencies
- Easily Share and Collaborate
Getting started
- Mac / Win users: install Docker Toolbox ;
- boot2docker
- CLI client & Docker Machine
- Docker Compose: docker-compose
- Kitematic (GUI) & Docker QuickStart shell
- DockerHub
- Demo!
- VM through Oracle’s VirtualBox
- Kitematic, the Docker GUI & Docker QuickStart shell
- Concept: Images v.s. Containers ≈ Classes v.s. Objects
- DockerHub => docker image repo
But... my DB server?
Options
- Use mySQLite?
- or a linked container?
Is this good enough?
- Extra management
- More commands
Solution: Docker Compose
“a tool for defining and running multi-container Docker applications”
Compose file docker-compose.yml
Wrapper CLI docker-compose
Docker Compose file
A docker-compose.yml looks like this:
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}
Using Docker Compose
- Configure yml file
- Up containers! docker-compose up -d
- Run docker-compose exec container_name drush status
- Stop docker-compose stop
- Destroy docker-compose destroy
Demo
- nginx & apache
- web (+ nginx), mysql, solr
Conclusion
- Docker is great
- Try it out
- Open any issues on the GitHub repo