Containers have their own language, and those new to Docker should understand some basic concepts and terminology before jumping in. This chapter introduces the vocabulary needed to navigate the terrain and a high-level view of how containers work. Let's begin by looking at containers in the context of another similar solution that readers may already be familiar with: virtual machines.
Three homes and three databases in this example is analogous to running separate hosts. The latter two scenarios focus on methods that share infrastructure and resources of a single host and explore ways of isolating and presenting schemas and data to applications. Containers and virtual machines perform similar roles.
Containers are even more efficient than shown here. Assuming the three applications hosted in these examples have similar foundations, most, if not all, of the binary, library, and application files of these containers are shared through overlay filesystems. This is discussed in greater detail in Chapter 17.
This is a basic example. Builds can involve multiple images and stages and may incorporate techniques to maximize layer reuse and minimize the size of the final image. A main objective of containers is efficiency—smaller images produce containers that pack more densely. Shared layers lower storage even further and take advantage of caching to improve overall performance. Techniques for building efficient images are covered in Chapter 17.