What is Docker?
Isolation and layers. Two simple architectural principles interwoven to provide one of the great paradigm shifts of our computing generation. Forget the marketing spiel behind ‘Big Data’ or the hype of ‘mobile’ and ‘cloud’, Docker is a truly revolutionary force that disrupts the developer’s desktop through to the datacentre deployment.
Docker is the natural amalgamation of linux containers (lxc) and a copy on write filesystem (aufs). Linux containers provide a mechanism to isolate host processes and resources while sharing the host kernel. Processes running in a container have native access to the host’s hardware without the overhead that you would incur in any other virtualised environment. Copy on write filesystems provide a way of pointing to a previous read-only image and adding a layer of changes to it. This mechanism allows a new instance of a file system to be created instantly, simply by pointing to the image and providing a new writable layer – also saving disk space in the process; all new instances point to the same image.
The real power of this isolation and layering only becomes apparent when you launch a container for the first time:
docker run –ti centos /bin/bash
In a few milliseconds you have a new instance of a complete centos server up and running. It has the full processing power and network resources of the host and a complete filesystem with centos installed – irrespective of the linux distribution that the host is running. Impressive, but not particularly useful. However, extend the base image with a service, such as a database (mysql, postgres…) or a web server and suddenly you have a self-contained, isolated service that can be instantiated quicker than you can read this sentence. Chain a few of these services together (web tier, application logic, data tier) and you have a complete application that will run on the developer’s laptop and can be thrown over the wall to Ops, unmodified to be deployed with horizontal scalability in the datacentre. The age of the microservice has dawned.