Docker is a powerful platform that simplifies the development process by allowing containerization of the applications. In simple words, Docker enables us to ship applications along with their dependencies (libraries, files etc).

In this hands-on exercise, we will learn fundamentals of Docker by performing basic operations, e.g.:

  1. Pulling an image from Docker registry

  2. Listing or Removing Images

  3. Creating ,Removing and Running a container 

  4. Starting or Stopping a container

  5. Listing containers and accessing container logs. 

  6. Building images from Dockerfiles and running in a container

Docker streamlines almost all phases of the development lifecycle, from development (i.e. allowing developers to work in standardised environments using local containers) to testing (i.e. running multiple instances to be tested by different tools/people in parallel) to finally deployment  at scale (i.e. deployment on Kubernetes or AWS ECS or serverless).

Read on to learn more on Docker:

 

Docker Architecture

 

Docker's architecture is designed to provide a lightweight and efficient containerization platform. The above figure provides a helpful illustration of Docker's architecture, which consists of several key components:

1. Docker Client:

The Docker client is the primary interface through which users interact with Docker. It accepts commands from the user and communicates with the Docker daemon to execute those commands. The client can run on the same host as the daemon or on a remote machine, allowing users to manage Docker resources remotely

2. Docker Daemon:

The Docker daemon (dockerd) is the heart of the Docker engine. It is a long-running process that manages Docker objects, such as containers, images, networks, and volumes. The daemon handles container orchestration, image pull and push, and other essential tasks related to running containers

3. Docker Images:

Docker images are read-only templates that contain the application code, runtime, libraries, environment variables, and other dependencies needed to run an application. Images are the building blocks for containers and can be versioned for easy management and sharing.

4. Docker Containers:

Docker containers are isolated and lightweight runtime instances created from Docker images. Each container runs an application and its runtime environment, isolated from other containers and the host system. Containers provide consistent behaviour across different environments and enable efficient resource utilisation.

5. Docker Registries:

Docker registries are repositories that store Docker images. They can be public or private and serve as central repositories for sharing and distributing Docker images. Docker Hub is the default public registry, while users can set up their private registries for secure image management.

6. Docker Network:

Docker networking allows containers to communicate with each other and the host system. Docker provides various networking options, such as bridge, host, overlay, and custom networks, to facilitate communication between containers and the outside world.

7. Docker Volumes:

Docker volumes are used to persist and share data between containers and the host system. Volumes enable data storage separate from container instances, ensuring data durability even if the container is removed.

The architecture diagram visually represents how these components interact with each other to provide a robust containerization platform. The Docker client communicates with the Docker daemon, which, in turn, manages containers, images, networks, and volumes. Docker images are stored in registries, which can be accessed by the Docker daemon for image management. Containers are created from images and run in isolated environments, enabling seamless deployment and consistent behaviour across various environments.

Overall, Docker's architecture streamlines the process of developing, shipping, and running applications within containers, making it a popular choice for modern software development and deployment workflows.

Uses of Docker:

  • Application Isolation: Docker allows applications to run in isolated environments, preventing conflicts with other applications or system libraries.
  • Portability: Docker containers are highly portable, ensuring seamless deployment across various platforms and cloud environments.
  • Resource Efficiency: Containers share the host system's OS kernel, resulting in resource efficiency and lower overhead compared to traditional virtualization.
  • Version Control: Docker images allow version control for your applications, simplifying rollbacks and updates.
  • Rapid Scaling: Docker's lightweight nature makes it ideal for rapidly scaling applications, both horizontally and vertically.