Architecture of Docker
Docker makes use of a client-server architecture. The Docker client talk with the docker daemon which helps in building, running, and distributing the docker containers. The Docker client run with the daemon on the same system or we can connect the docker client with the docker daemon remotely. With the help of REST API over a UNIX socket or a network, the docker client and daemon interact with each other.
Docker daemon manages all the services by communicating with other daemons. It manages docker objects such as images, containers, networks, and volumes with the help of the API requests of Docker.
With the help of the docker client, the docker users can interact with the docker. The docker command uses the Docker API. The Docker client can communicate with multiple daemons. When a docker client runs any docker command on the docker terminal then the terminal sends instructions to the daemon. The Docker daemon gets those instructions from the docker client withinside the shape of the command and REST API’s request.
The main objective of the docker client is to provide a way to direct the pull of images from the docker registry and run them on the docker host. The common commands which are used by clients are docker build, docker pull, and docker run.
A Docker host is a type of machine which is responsible for running more than one container. It comprises of the Docker daemon, Images, Containers, Networks, and Storage.
All the docker images are stored in the docker registry. There is a public registry which is known as a docker hub that can be used by anyone. We can run our private registry also. With the help of docker run or docker pull commands, we can pull the required images from our configured registry. Images are pushed into configured registry with the help of the docker push command.
Whenever we are using a docker, we are creating and use images, containers, volumes, networks and other objects. Now, we are going to discuss docker objects:-
An image contains instructions for creating a docker container. It is just a read-only template. It is used to store and ship applications. Images are an important part of the docker experience as they enable collaboration between developers in any way which is not possible earlier.
Containers are created from docker images as they are ready applications. With the help of Docker API or CLI, we can start, stop, delete or move a container. A container can access only those resources which are defined in the image unless additional access is defined during the building of an image in the container.
We can store data within the writable layer of the container but it requires a storage driver. Storage driver controls and manages the images and containers on our docker host.
Keeping the persistent storage as a reference, docker offer 4 options:-
- Data Volumes
- Volume Container
- Directory Mounts
- Storage Plugins
Docker networking provides complete isolation for docker containers. It means a user can link a docker container to many networks. It requires very less OS instances to run the workload.
There are primarily 5 network drivers in docker:
- Bridge: It is the default network driver. We can use this when different containers communicate with the same docker host.
- Host: When you don’t need any isolation between the container and host then it is used.
- Overlay: For communication with each other, it will enable the swarm services.
- None: It disables all networking.
- macvlan: This network assigns MAC(Media Access control) address to the containers which look like a physical address.
Please Login to comment...