Docker and Docker Swarm (Part 3 – Docker Components & Features)

Tram Ho

I. Components of Docker

1. Docker Engine

Docker Engine is the core part of Docker, as an application packaging tool, built in client-server architecture and installed on the host machine.

Docker Engine has 3 components:

  • Server: Docker Daemon is used to create and manage images, containers, networks, volumes.
  • Rest API: controller for the docker daemon, indicating what the docker daemon will do.
  • Client: Is a tool to help users communicate with Docker host. Users interact with docker via command in terminal (CLI). Docker Client will use API to send commands to Docker Daemon.

There are 5 big objects in the world of Docker Engine:

a. Image

  • A Dockerfile is a text file without an extension that contains the specifications of a software executable field, the structure for the Docker image.
  • Docker images can be generated automatically by reading the instructions in the Dockerfile.
  • From those commands, Docker will build a Docker image (usually from a few MB to a few GB large).

b. Docker file

  • Image in docker is also known as mirror, it is a packaging unit that contains everything needed for an application to run.
  • Image is made up of many layers stacked on top of each other, inside the image is a stripped down operating system and all the dependencies needed to run an application.

c. Container

  • An image can be used to create 1 or more containers.
  • You can create, start, stop, move or delete based on Docker API or Docker CLI.
  • On the operating system, we install the container engine as docker. The container engine then takes the operating system resources and assembles them into separate structures called containers.
  • Each container includes everything needed to run it:  code, runtime, system tools, system libraries, settings. Each container is like a real operating system, inside each
  • container will run 1 application.
  • Containers and VMs have similar isolation and resource allocation but have different functionality because the container virtualizes the operating system instead of the hardware.
  • Containers are more portable and efficient.
  • Containers are meant to make applications easy to build, move, and run.

The process of putting an application running in a container can be understood as follows:

  1. First we start with the app code and its dependencies
  2. Create a Dockerfile describing the app, its dependencies and how to run the app
  3. Build Dockerfile to image
  4. Push newly built image to registry(option)
  5. Run container from image

d. Network

Docker network is responsible for providing a private network (VLAN) so that containers on one host can communicate with each other, or containers on multiple hosts can communicate with each other (multi-host networking).

e. Volume

Docker volume là cơ chế tạo và sử dụng dữ liệu của docker, có nhiệm vụ lưu trữ dữ liệu độc lập với vòng đời của container.

There are 3 use cases for Docker Volumes:

  1. Retains data when a Container is deleted.
  2. To share data between the physical host and the Docker Container.
  3. Share data between Docker Containers.

2. Docker Registry/Docker Hub

Docker Registry is a server service that allows storing docker images of individuals, companies, teams, etc. Docker Registry service can be provided by a 3rd party organization or is a built-in internal service. own if you want.

Some popular Docker Registry services are:

  • Azure Container Registry
  • Docker Hub
  • Quay Enterprise
  • Google Container Registry.
  • AWS Container Registry

II. Functions and roles of Docker

1. Functions

  • Docker allows to develop, migrate, and run applications based on virtualization technology in linux.
  • Automatically deploy applications inside containers by providing an extra layer of abstraction and automating level virtualization (OS)
  • Docker can be used on operating systems such as: Windows, Linux, MacOS.

2. Roles

  • Flexible:  Easy to deploy in many different environments by eliminating the dependency of the application on the OS layer as well as the infrastructure.
  • Space saving:  container is built based on many existing images, thereby saving more storage space.
  • Uniform: no environmental differences when deployed anywhere, creating consistency when working as a team.
  • Fast:  Due to shared host OS, containers can be created almost instantly, booting is also much faster.


[1]. How node works

[2]. Docker docs

[3]. Docker là gì?

Share the news now