7: Containers
Docker implements the Open Container Initiative (OCI) specifications. This means everything you learn in this chapter applies to other container runtimes and platforms that implement the OCI specifications.
We’ll split this chapter into the usual three parts:
- The TLDR
- The deep dive
- The commands
Docker containers - The TLDR
A container is the runtime instance of an image. In the same way that you can start a virtual machine (VM) from a virtual machine template, you start one or more containers from a single image. The big difference between a VM and a container is that containers are smaller, faster, and more portable.
Figure 7.1 shows a single Docker image being used to start multiple Docker containers.
The simplest way to start a container is with the docker run
command. The command can take a lot of arguments, but in its most basic form you tell it an image to use and an app to run: docker run <image> <app...