Understanding Docker Architecture and Components

Docker Easy to Learn Part-1

Docker is a set of the platform as service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.

Dockerization

Dockerizing is the process of packing, deploying, and running applications using Docker containers. Docker is an open-source tool that ships your application with all the necessary functionalities as one package. You can use Docker to pack your application with everything you need to run the application (such as libraries) and ship it as one package – a container. 

Containers are created from images that specify their precise contents. Dockerizing is a big hit nowadays. All the big names use it – Google, VMware, or Amazon support it.

There are two parts of Docker:

  1. The Docker Engine – a portable packaging tool
  2. The Docker Hub – cloud service for sharing applications

The Docker container allows another user to quickly recreate the computing environment. The container provides operating virtualization by abstracting the “user space”. This technology ensures that your colleagues are developing or testing the product using the same environment as you which results in fewer errors.

Docker Architecture Overview

At the core of Docker’s architecture lies several key components that work together seamlessly to enable containerization:

  • Docker User: Initiates actions and interacts with Docker through the command-line interface (CLI) or API.
  • Docker Client: A command-line tool that allows users to interact with Docker by issuing commands to the Docker daemon.
  • Docker Daemon: Also known as dockerd, this is the background service that manages Docker objects, such as images, containers, networks, and volumes.
  • Containerd (Container Runtime Engine): An industry-standard core container runtime that manages the container lifecycle, including image transfer and storage, container execution, and supervision.
  • Kernel: The underlying operating system kernel that provides low-level system functionalities required for container execution.
  • Namespace (NS): A feature of the Linux kernel that provides isolation between containers, ensuring that each container operates in its own namespace without interfering with others.
  • INIT: The process responsible for initializing the container’s environment and executing the user-specified command.

Docker Components

This image has an empty alt attribute; its file name is XtDs3OZwHpiO-6n-3OVG_GPlwPFzpRt62IAYJ6kfdQz9OJGFFGVPUauNvAauC3mAC40M_WitNLrL1gbE4SMrxRSC-ndGVLsWZMXDHn3x7WAQbDOPNQlJ6ktP3SAzxxYrhxisZd8N3w8U1a725W-_tHo

1. Docker Engine

  • The core component of Docker that comprises both the Docker Daemon and the Containerd runtime.

2. Docker CLI

  • Command-line interface used for interacting with Docker.

3. Docker Image

  • A lightweight, standalone, executable package that includes everything needed to run a piece of software, such as code, runtime, libraries, and dependencies.

4. Docker Container

  • An instance of a Docker image that runs as a process, isolated from the host system and other containers.

5. Docker Registry

  • A repository for storing and distributing Docker images. It can be either public (like Docker Hub) or private, enabling teams to manage their own image repositories.

Docker Lifecycle

Container Lifecycle

  • Creation: docker create creates a container without starting it.
  • Renaming: docker rename allows renaming a container.
  • Starting and Stopping: docker start, docker stop, docker restart, docker pause, docker unpause, and docker wait manage the container’s lifecycle.
  • Information Retrieval: Commands like docker ps, docker logs, docker inspect, docker events, docker port, docker top, docker stats, docker diff, and docker ps -a provide information about containers and their performance.
  • Import/Export: docker cp, docker export, docker import, docker load, and docker save facilitate importing/exporting containers and images.

Image Lifecycle

  • Management: docker images, docker import, docker build, docker commit, and docker rmi manage Docker images.
  • History and Tagging: docker history and docker tag provide image history and tagging functionalities.
  • Cleanup: Tools like docker-gci aid in cleaning up unused images.

Dockerfile

A Dockerfile is a text document that contains instructions for building a Docker image. It specifies the environment and configuration of the containerized application. Key directives include:

  • FROM: Sets the base image.
  • RUN: Executes commands in a new layer.
  • CMD: Provides defaults for container execution.
  • EXPOSE: Informs Docker about the container’s listening ports.
  • ENV: Sets environment variables.
  • VOLUME: Creates mount points for volumes.
  • ENTRYPOINT: Configures the container’s main command.

Understanding Docker’s architecture and components, along with implementing security measures, empowers developers and system administrators to leverage Docker effectively while ensuring the security of their applications and environments.

Part 02 will be published the next day, stay with us

One thought on “Understanding Docker Architecture and Components

Leave a Reply

Your email address will not be published. Required fields are marked *