Unless you have been living under a metaphorical rock you will have heard about Docker. But although lots of people have heard of Docker, far fewer are using it day-to-day and even less in production. In this short post, I am going to go over what Docker (and containers are) and how you can start to get up and running with Docker.
Wikipedia describes Docker as:
Docker is an open-source project that automates the deployment of Linux applications inside software containers. Docker provides an additional layer of abstraction and automation of operating-system-level virtualization on Linux.
But what does that really mean to you? Largely it means that you can run multiple smaller machines inside 1 machine. But you only need to run small parts of that system. If you compare it to Virtualisation, or Virtual Private Servers, the difference becomes more evident. In virtualisation, you take a large server and using virtualisation software split that main system down into separate ones, so that you can install whatever operating system you like. However, that still means that you have multiple full operating systems, everything whether you need it or not. Now this is where the difference comes. With containers you can split 1 main system up, but rather than install full operating systems inside it, just install pretty much the systems you want. Just want PHP installed in a container? No problem!
Docker runs really well on Linux and Mac (and I assume Windows although I have no experience). They have pretty great documentation for getting started with Docker. Pretty much, my advice would be use Docker for Mac if you are on a Mac. The install is simple and it works pretty seamlessly. For Linux, use the official Docker repo rather than the one bundled into whatever distro you are using:
Precise 12.04 (LTS) —> deb https://apt.dockerproject.org/repo ubuntu-precise main Trusty 14.04 (LTS) —> deb https://apt.dockerproject.org/repo ubuntu-trusty main Wily 15.10 —> deb https://apt.dockerproject.org/repo ubuntu-wily main Xenial 16.04 (LTS) —> deb https://apt.dockerproject.org/repo ubuntu-xenial main
sudo apt-get install update sudo apt-get install docker
[dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg
sudo yum update sudo yum install docker
Then just run docker –version!
➜ ~ docker --version Docker version 1.12.3, build 6b644ec