Components of Docker and its Brief Summary
The Docker components are divided into two categories; basic and advanced. The basic components include Docker client, Docker image, Docker Daemon, Docker Networking, Docker registry, and Docker container, whereas Docker Compose and Docker swarm are the advanced components of Docker.
Basic Docker Components:
Lets dive into basic docker components:
- Docker Client: The first component of Docker is the client, which allows the users to communicate with Docker. Being a client-server architecture, Docker can connect to the host remotely and locally. As this component is the foremost way of interacting with Docker, it is part of the basic components. Whenever a user gives a command to Docker, this component sends the desired command to the host, which further fulfils the command using the Docker API. If there are multiple hosts, then communicating with them is not an issue for the client as it can interact with multiple hosts.
- Docker Image: Docker images are used to build containers and hold the entire metadata that elaborates the capabilities of the container. These images are read-only binary templates in YAML. Every image comes with numerous layers, and every layer depends on the layer below it. The first layer is called the base layer, which contains the base operating system and image. The layer with dependencies will come above this base layer. These layers will have all the necessary instructions in read-only, which will be the Dockerfile. A container can be built using an image and can be shared with different teams in an organization through a private container registry. In case you want to share the same outside the organization, you can use a public registry for the same.
- Docker Daemon: Docker Daemon is among the most essential components of Docker as it is directly responsible for fulfilling the actions related to containers. It mainly runs as a background process that manages parts like Docker networks, storage volumes, containers, and images. Whenever a container start up command is given through docker run, the client translates that command into an HTTP API call and returns it to the daemon. Afterwards, the daemon analyses the requests and communicates with the operating system. The Docker daemon will only respond to the Docker API requests to perform the tasks. Moreover, it can also manage other Docker services by interacting with other daemons.
- Docker Networking: As the name suggests, Docker networking is the component that helps in establishing communication between containers. Docker comes with five main types of network drivers, which are elaborated on below.
- None: This driver will disable the entire networking system, hindering any container from connecting with other containers.
- Bridge: The Bridge is the default network driver for a container which is used when multiple containers communicate with the same Docker host.
- Host: There are stances when the user does not require isolation between a container and a host. The host network driver is used in that case, eradicating this isolation.
- Overlay: Overlay network driver allows communication between different swarm services when the containers run on different hosts.
- macvlan: This network driver makes a container look like a physical driver by assigning a mac address and routing the traffic between the containers through this mac address.
- Docker Registry: Docker images require a location where they can be stored and the Docker registry is that location. Docker Hub is the default storage location of images that stores the public registry. However, registries can either be private or public. Every time a Docker pull request is made, the image is pulled from the desired Docker registry where it was the same. On the other hand, Docker push commands store the image in the dedicated registry.
- Docker Container: A Docker container is the instance of an image that can be created, started, moved, or deleted through a Docker API. Containers are a lightweight and independent method of running applications. They can be connected to one or more networks and create a new image depending on the current state. Being a volatile Docker component, any application or data located within the container will be scrapped the moment the container is deleted or removed. Containers mostly isolate each other and have defined resources.
Docker Advanced Components:
- Docker Compose: Sometimes you want to run multiple containers but as a single service. This task can be accomplished with the help of Docker compose as it is specifically designed for this goal. It follows the principle of isolation between the containers but also lets the containers interact with each other. The Docker compose environments are also written using YAML.
- Docker Swarm: If developers and IT admins decide to create or manage a cluster of swarm nodes in the Docker platform, they can use the Docker swarm service. There are two types of swarm nodes: manager and worker. The manager node is responsible for all the tasks related to cluster management, whereas the worker node receives and implements the tasks sent by the manager node. No matter the type, every Docker swarm node is a Docker daemon and communicates through Docker API.