VMs are houses, containers are apartments!

By | December 24, 2017

A couple of weeks ago I had occassion to be a delegate at DockerCon 2016, held in Seattle, USA. To be honest I hadn't had much experience with Docker before so I was so excited to be able to study new things. Recently, I have spent some time on Docker and this post begins a series about this solution and covers the following topics:

  • What is Docker?
  • Docker architecture
  • Virtual Machines vs Containers
  • My thoughts

Docker overview and architecture

Docker is an open platform for developing, shipping, and running applications. Following Docker page, we can find out that:

Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

Simply put: Containers are instances (writable) of images (readable). Docker containers can be run on Windows, Linux and Mac as well. Docker's architecture is based on client-server relationship:


source: docker.com

The Docker client talks to the Docker daemon which is responsible for Docker containers. There are three important components:

  • Docker images - already mentioned, a read-only pattern/template, e.g. WordPress instance on Fedora. It consists some layers that are combined by Docker using union file systems.
  • Docker registry - public (Docker Hub)or private places where images are kept.
  • Docker container - an isolated and writable (by adding a read-write layer on top of the image) application platform with operating system, user-added files, and meta-data.

Virtual Machines vs Containers

During mentioned DockerCon and Mike Coleman's presentation, I heard a great analogy - "VMs are houses, containers are apartments". We should remember that containers are not VMs but those technologies can be used together - Docker containers can be created inside VMs. The below figure presents that the underlying architecture between VM and container is different:


source: docker.com

Containers are on top of the same kernel, and sharing most of the base operating system, containers are much smaller (just required binaries and libraries) compared to VMs. Both containers and virtual machines provide isolation, however in different way. VMs are isolated by Hypervisor which runs on the hardware. Containers are isolated by the Operating System (OS level) using special kernel extensions.

My thoughts

I remember when I was a System Administrator and I used FreeBSD Jails or Solaris Zones to build/run an instance of system with a single function, such as website server, database server. It was not easy and time consuming way, at least for beginners. Containers are the next step in our data centers providing simplified configuration, portability,  rapid development and more. If such companies as VMware (Photon OS - a minimal Linux container host running on vSphere) or Microsoft (native containers in Windows 2016 but also partnership with Docker) introduced their solution for better integration with containers, there is something to it 🙂 However, we should select the right applications to run in containers.

Is Docker ready for enterprise software? I will try to answer for this question in the next post. Stay tuned!

Author: Mariusz

Architect (~ 15 years experience based on passion...) with strong background as a System Administrator and Engineer. Focused on Data Center Solutions: Virtualization/Cloud Computing and Storage/Backup Systems. Currently living in Poland.