Docker
“Containerisation is the new Virtualisation.”
I’m a huge advocate of Platform as a Service (PaaS), specifically Heroku.
Heroku enables developers to forget about the infrastructure and middleware, allowing them to focus on their application (simply push code and let the platform do the rest).
The “secret source” of Heroku is the understanding that web apps, databases and worker jobs are just Unix processes and Unix doesn’t care about the stack. It’s this philosophy that enables Heroku to be cross-language, by focusing on Unix processes and producing environments (via Buildpacks) that can run any server process.
This is where containers come in! Heroku uses lightweight containers called Dynos, which run a single user-specified command. With containers you can very quickly and efficiently run thousands of services on a single virtual machine, each thinking they have their own system.
This is all great and it’s a core part of why I love Heroku. However, it’s what happens when you expand on this concept that things become really interesting…
Introducing Docker
Docker is an open-source project to easily create lightweight, self-sufficient containers from any application, that will run anywhere.
Let’s break that down:
Open Source - Although Docker was created by a commercial company (dotCloud), it’s open-source and has a thriving community.
Lightweight - Containers are insanely fast, providing bare-metal access to the hardware. No need to worry about a hypervisor layer.
Self-sufficient - Each container comprises of just the application and its dependencies. It runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers.
Application - Containers package applications, not machines (making it application centric). Unlike traditional virtual machines a Docker container does not include a separate operating system.
Run Anywhere - Run on any machine, with guaranteed consistency, for example: local (OS X, Linux, Windows), Data Centre (Red Hat, etc.) and Cloud Infrastructure (AWS EC2, Rackspace, etc.)
The primary difference between a traditional Virtual Machine stack and a Docker stack, is that the Docker Engine container includes just the application and its dependencies.
Why Docker?
With Docker, developers can build any application in any language using any toolchain. Just like shipping containers, “Dockerised” apps are completely portable and can be loaded anywhere. This provides developers complete flexibility and consistency, when developing applications.
Docker also has an impressive community offering, with over 13,000+ images available on Docker Hub. This enables rapid application development, through the use of pre-built capabilities.
However, Docker is not just great for developers, system admins can use Docker to provide standardised environments for their development, QA, and production teams, removing the challenges of ensuring consistency across different environments.
Get Started
I plan to post a lot more regarding Docker, but the easiest way to learn is to experience it for yourself. I suggest you head over to the official Docker Installation guide and look-up the instructions for your system, you can then grab an image from the Docker Hub (for example, Ghost, WordPress, PHP, etc.) and start playing.
I’ve already got a number of web application containers up and running across OS X and Ubuntu and I have set-up my own portable “Heroku-like” PaaS using Dokku, all powered by Docker!