7 CHAPTER 2 | Introduction to Containers and Docker
So, when you “look” at the filesystem after the layer has been copied, you see all the files, included the
layer when the program was installed.
You can think of an image as an auxiliary read-only hard disk ready to be installed in a “computer”
where the operating system is already installed.
Similarly, you can think of a container as the “computer” with the image hard disk installed. The
container, just like a computer, can be powered on or off.
Docker terminology
This section lists terms and definitions you should be familiar with before getting deeper into Docker.
For further definitions, see the extensive glossary provided by Docker.
Container image: A package with all the dependencies and information needed to create a container.
An image includes all the dependencies (such as frameworks) plus deployment and execution
configuration to be used by a container runtime. Usually, an image derives from multiple base images
that are layers stacked on top of each other to form the container’s filesystem. An image is immutable
once it has been created.
Dockerfile: A text file that contains instructions for how to build a Docker image. It’s like a batch
script, the first line states the base image to begin with and then follow the instructions to install
required programs, copy files and so on, until you get the working environment you need.
Build: The action of building a container image based on the information and context provided by its
Dockerfile, plus additional files in the folder where the image is built. You can build images with the
Docker docker build command.
Container: An instance of a Docker image. A container represents the execution of a single
application, process, or service. It consists of the contents of a Docker image, an execution
environment, and a standard set of instructions. When scaling a service, you create multiple instances
of a container from the same image. Or a batch job can create multiple containers from the same
image, passing different parameters to each instance.
Volumes: Offer a writable filesystem that the container can use. Since images are read-only but most
programs need to write to the filesystem, volumes add a writable layer, on top of the container image,
so the programs have access to a writable filesystem. The program doesn’t know it is accessing a
layered filesystem, it is just the filesystem as usual. Volumes live in the host system and are managed
by Docker.
Tag: A mark or label you can apply to images so that different images or versions of the same image
(depending on the version number or the target environment) can be identified.
Multi-stage Build: Is a feature, since Docker 17.05 or higher, that helps to reduce the size of the final
images. In a few sentences, with multi-stage build you can use, for example, a large base image,
containing the SDK, for compiling and publishing the application and then using the publishing folder
with a small runtime-only base image, to produce a much smaller final image
Repository (repo): A collection of related Docker images, labeled with a tag that indicates the image
version. Some repos contain multiple variants of a specific image, such as an image containing SDKs