Docker (www.docker.com) has been a major force behind popularizing the containerization of applications. Docker is to containers what Google is to search engines. Sometimes, people even use containers and Docker as synonyms. Microsoft has partnered with Docker and is actively contributing to the Docker platform and tools in open source. This makes Docker important for us as .NET developers.
Docker is a very important topic and will be significant enough to learn for any serious .NET developer. However, due to time and scope constraints, we will just scratch the surface of the ecosystem of Docker here. We strongly recommend that you read through the Docker books made available by Packt Publishing.
Now let's focus on some of the terminologies and tools of the Docker platform. This will be essential for our next section:
- Docker image: A Docker image is a read-only template with instructions for creating a Docker container. A Docker image consists of a separate filesystem, associated libraries, and so on. Here, an image is always read-only and can run exactly the same abstracting, underlying, host differences. A Docker image can be composed of one layer on top of another. This composability of the Docker image can be compared with the analogy of layered cake. Docker images that are used across different containers can be reused. This also helps reduce the deployment footprint of applications that use the same base images.
- Docker registry: A Docker registry is a library of images. A registry can be either public or private. Also, it can be on the same server as the Docker daemon or Docker client or on a totally separate server.
- Docker hub: This is a public registry and it stores images. It is located at http://hub.docker.com.
- Dockerfile: Dockerfile is a build or scripting file that contains instructions to build a Docker image. There can be multiple steps documented in a Dockerfile, starting with getting the base image.
- Docker container: A Docker container is a runnable instance of a Docker image.
- Docker compose: Docker compose allows you to define an application’s components—their containers, configuration, links, and volumes—in a single file. Then, a single command will set everything up and start your application. It is an architecture/dependency map for your application.
- Docker swarm: Swarm is the Docker service by which container nodes work together. It runs a defined number of instances of a replica task, which is itself a Docker image.
Let's look into the individual components of the Docker ecosystem; let's try to understand one of the ways in which the Docker workflow makes sense in the software development life cycle.