4. @mlteal | #WCPHX | 2019
Local Development
• Local machine
• MAMP/WAMP/XAMPP
• Vagrant
• Varying Vagrant Vagrants (VVV)
• ServerPress, Local by Flywheel, etc
5. @mlteal | #WCPHX | 2019
What & Why?
1. https://aws.amazon.com/docker/
2. https://www.docker.com/why-docker
• “Software platform that allows you to build, test,
and deploy applications quickly”
• [Relatively] simple yet powerful tooling
• Performance
Docker Docker Docker…
6. @mlteal | #WCPHX | 2019
Project
Service A
(Database)
Image: mysql-5.7
Getting Started with Docker
Service B
(Webserver)
Image: nginx
Service C
(WordPress)
Image: php7.2-fpm
8. @mlteal | #WCPHX | 2019
Required
• Docker for [your OS]
• Terminal
Getting Started with Docker
Optional
• Homebrew (MacOS/Linux)
• Docker Compose
9. @mlteal | #WCPHX | 2019
DockerHub
Images are published to
DockerHub and are
downloaded and used as
a quick-start for projects.
Starting with an Image
11. @mlteal | #WCPHX | 2019
Starting with a Dockerfile
A Dockerfile is a text file that contains the commands a user wants
to call to assemble an image.
• A linux distribution
• PHP
Basic Platform Requirements
• Apache and/or NGINX
• MySQL
12. @mlteal | #WCPHX | 2019
Starting with a Dockerfile
FROM wordpress:php7.1-apache
COPY . /var/www/html
Starting with an all-in-one approach:
1. Download WP Core into a directory on your local machine
2. Create a Dockerfile in that directory with the following:
13. @mlteal | #WCPHX | 2019
Starting with a Dockerfile
Starting with an all-in-one approach:
🦄 :~$ cd myproject
🦄 :myproject$ docker build -t ‘my-image’ .
🦄 :myproject$ docker run --name mysql-cont -e MYSQL_ROOT_PASSWORD=qwerty -d
mysql:5.7
🦄 :myproject$ docker run --name wp-cont --link mysql-cont:mysql -p 8000:80 -d my-image
🦄 :myproject$ docker stop wp-cont
3. Build the image
4. Run the mysql container
5. Run the WP container — accessed at http://localhost:8000
14. @mlteal | #WCPHX | 2019
Important Commands
🦄 :~$ docker image ls
🦄 :~$ docker inspect [IMAGE TAG or ID]
🦄 :~$ docker stop [CONTAINER NAME]
🦄 :~$ docker ps # lists ALL containers and their statuses
🦄 :~$ docker ps | grep [Container ID OR Name (can be partial)]
🦄 :~$ docker exec -ti [Container ID or Name] bash
Find docs and all commands at
https://docs.docker.com/engine/reference/commandline/
19. @mlteal | #WCPHX | 2019
Docker Compose
🦄 :~$ cd myproject
🦄 :myproject$ docker-compose up
…
🦄 :myproject$ docker-compose down
1. Build and run your app with compose: