2. Patrick Mizer
SpareFoot - Austin, TX
ZCE: PHP4, PHP5, ZF
We use Docker at SpareFoot:
● Containers for PHP services in dev
● CI server builds and deploys containers
● Containers in production for Solr Search and Node.js
apps
4. First, what I am NOT going to cover
Docker internals
○ LXC Containers
■ Kernel namespacing (pid, mnt, net, user, ipc)
■ Control groups (blkio, cpu, devices)
5. First, what I am NOT going to cover
The Docker - CoreOS Debate
○ Rocket vs Docker
○ Whether everything running through one daemon is
a security risk
○ Whether Docker is a platform or a composable
building block
7. What I am going to cover
● What is Docker?
● Why you should care about Docker
● How Docker works
● Building a Docker container for a PHP
application
● Docker tools
○ Compose
○ Docker-Machine
○ Swarm
● Live demos (time permitting)
9. What is Docker?
Docker is an open platform for developers and
sysadmins to build, ship, and run distributed
applications.
Docker enables apps to be quickly assembled
from components and eliminates the friction
between development, QA, and production
environments.
15. Physical Server
Host OS
Hypervisor
Guest OS
Libs
App
Guest OS
Libs
App
Physical Server
Host OS
Docker Engine
Libs
App
Libs
App
Virtual machine model Docker model
16. Physical Server
Host OS
Docker Engine
Libs
App
Libs
App Docker Containers
● Smaller than VMs (no O/S)
● Isolation of VMs without overhead
The Container
30. Why you should care
● Portable runtime environment for your code
○ Stable dev environment
○ Build once, run anywhere*
31. Why you should care
● Portable runtime environment for your code
○ Stable dev environment
○ Build once, run anywhere*
● Immutable build artifacts
○ Avoid dependency hell
○ Avoid “drift”
32. Why you should care
● Portable runtime environment for your code
○ Stable dev environment
○ Build once, run anywhere*
■ New technologies!
● Immutable build artifacts
○ Avoid dependency hell
○ Avoid “drift”
● Clear separation of concerns
○ Dev - Code, Dependencies, Libs
○ DevOps - Provisioning, Logging, Network
91. Community images
% docker search php
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
php While designed for web development, the PH... 148 [OK]
tutum/apache-php Apache+PHP base image - listens in port 80... 59 [OK]
maxexcloo/nginx-php Docker framework container with Nginx and ... 30 [OK]
eboraas/apache-php PHP5 on Apache (with SSL support), built o... 17 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable ... 10 [OK]
php-zendserver Zend Server - the integrated PHP applicati... 10 [OK]
clue/phpvirtualbox phpVirtualBox is a modern web interface de... 9 [OK]
jdeathe/centos-ssh-apache-php CentOS-6 6.5 x86_64 / Apache / PHP / PHP m... 8 [OK]
jprjr/php-fpm Arch Linux-based image with PHP-FPM instal... 8 [OK]
darh/php-essentials Provides a container full of php-cli tools... 7 [OK]
million12/nginx-php Nginx + PHP-FPM, CentOS-7 based. 5 [OK]
reinblau/php-apache2 Apache2 Server for PHP Projects 4 [OK]
eriksencosta/php-dev Docker image with latest supported PHP ver... 4 [OK]
alreece45/phusion-nginx-php nginx and php-fpm with configurable docume... 3 [OK]
million12/php-app-ssh million12/php-app, extended with SSHD and ... 2 [OK]
simpledrupalcloud/php 1 [OK]
yoshz/apache-php-dev A docker image with Apache, PHP 5.5, drush... 1 [OK]
azukiapp/php-apache Base docker image to run PHP applications ... 1 [OK]
98. Fig Docker Compose
Compose is a tool for defining and running
complex applications with Docker. With
Compose, you define a multi-container
application in a single file, then spin your
application up in a single command which does
everything that needs to be done to get it
running.
102. Docker Machine
Docker Machine takes you from zero-to-Docker in
seconds with a single command.
Before Docker Machine, a developer would need to log in
to the host and follow installation and configuration
instructions specifically for that host and its OS. With
Docker Machine, whether provisioning the Docker daemon
on a new laptop, on virtual machines in the data center, or
on a public cloud instance, the same, single command.
104. Docker Swarm
Docker Swarm is native clustering for Docker. It turns a
pool of Docker hosts into a single, virtual host.
Swarm serves the standard Docker API, so any tool which
already communicates with a Docker daemon can use
Swarm to transparently scale to multiple hosts: Dokku,
Compose, Krane, Flynn, Deis, DockerUI, Shipyard, Drone,
Jenkins... and, of course, the Docker client itself.
106. “Cows not pets”
Pets
● Pets have names
● They are unique, loving, hand
raised and cared for
● When they are sick, they are
taken to the vet.
107. “Cows not pets”
Pets
● Pets have names
● They are unique, loving, hand
raised and cared for
● When they are sick, they are
taken to the vet.
Cows
● Cows have numbers
● They are not unique, they are a
commodity.
● When they are sick....?
108. “Cows not pets”
Pets
● Pets have names
● They are unique, loving, hand
raised and cared for
● When they are sick, they are
taken to the vet.
Cows
● Cows have numbers
● They are not unique, they are a
commodity.
● When they are sick....?