An introduction to contianers and Docker for PHP developers
An Introduction to
Containers and Docker
for PHP Developers
• What are Linux containers
• What is Docker
• What is Docker Compose
• Why use Vagrant
• Using Docker
• Creating a PHP development
environment using Vagrant and
• How the PHP community can use
Software that interfaces with the Linux kernel containment
• Enable creating an abstraction of a particular global
system resource and make it appear as a separated
instance to processes within a namespace.
Control Groups (cgroups)
• The kernel uses cgroups to group processes for the
purpose of system resource management. Cgroups
allocate CPU time, system memory, network bandwidth, or
combinations of these among user-deﬁned groups of tasks.
Containers fall between a chroot and
a full ﬂedged virtual machine.
Application level containers have a best practice convention
of one process per container.
Containers offer less isolation compared to a VM because each
container shares the Linux kernel, and possibly binaries and
libraries, but they also have a lower resource overhead.
Diagram source: Docker Inc.
Docker is a container technology that allows you to
package an application with all of its dependencies into
a standardized unit for software development.
Docker allows applications to share the same Linux
kernel as the Docker host. Applications need to be
bundled with any software not already installed on the
What is Docker ?
Instructions for installing Docker on 20 different OS/
curl -sSL https://get.docker.com/ | sh
Compose is a tool for deﬁning and running multi-
container applications with Docker.
You deﬁne a multi-container application, then spin your
application up in a single command which does
everything that needs to be done to get it running.
What is Docker Compose?
Container vs. Image
How are a container and an image different?
• An image is a read-only template used to
• Images are built.
• Containers are started/stopped.
Why include Vagrant?
• Vagrant is is used to supply a Linux Docker host.
• Vagrant also gives us the ability to have a shared folder.
• Even if you are on a Linux OS can still use Vagrant, but
• Vagrant also gives us Shared folders and make
forwarding ports easy.
Docker has been focused on container