Many individuals wrongly compare containers to VMs. However, this is a questionable comparison. Containers are not just lightweight VMs.
Containers are specially encapsulated and secured processes running on the host system.
Containers leverage a lot of features and primitives available in the Linux OS. The most important ones are
All processes running in containers share the same Linux kernel of the underlying host operating system. This is fundamentally different compared with VMs, as each VM contains its own full-blown operating system.
The startup times of a typical container can be measured in milliseconds, while a VM normally needs several seconds to minutes to startup. VMs are meant to be long-living. It is the primary goal of each operations engineer to maximize the uptime of their VMs. Contrary to that, containers are meant to be ephemeral. They come and go in a quick cadence.
Here, we have an architectural diagram on how this all fits together:
On the lower part of the the preceding figure, we have the Linux operating system with its
On top of all that now sits the Docker engine. The Docker engine offers a RESTful interface to the outside world that can be accessed by any tool, such as the Docker CLI, Docker for Mac, and Docker for Windows or Kubernetes to just name a few.