This post is the second video of our five-part video series on “Docker & Kubernetes”.
In this video blog, we are covering the Architecture & Components of Docker and Container lifecycle.
Note: If you have missed my previous post on “Docker vs Virtual Machine”, to check previous post click here https://k21academy.com/docker12
Docker Architecture | Docker Components
Docker uses a client-server architecture. The docker client talks to the Docker daemon, which used to building, running, and distributing the Docker containers. The Docker client and daemon communicate using a REST API, over UNIX sockets, or a network interface.
There are five major components in the Docker architecture:
a) Docker Daemon listens to Docker API requests and manages Docker objects such as images, containers, networks, and volumes.
b) Docker Clients: With the help of Docker Clients, users can interact with Docker. Docker client provides a command-line interface (CLI) that allows users to run, and stop application commands to a Docker daemon.
c) Docker Host provides a complete environment to execute and run applications. It comprises of the Docker daemon, Images, Containers, Networks, and Storage.
d) Docker Registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to use images on Docker Hub by default. You can run your own registry on it.
e) Docker Image read-only templates that you build from a set of instructions written in Dockerfile. Images define both what you want your packaged application and its dependencies to look like what processes to run when it’s launched.
Note: To know more about Docker image
Resources Isolation In Container (Docker)
a) Namespace provides a layer of isolation. namespace limits what you can see. When we run a container, Docker creates a set of namespaces for that container. There are different types of namespace pid, net, mnt, uts, ipc.
b) Control groups limit an application to a specific set of resources. it limits how much resources you can use. This allows Docker Engine to share available hardware resources to containers and optionally enforce limits and constraints.
c) Union file systems that operate by creating layers, Docker image is made up of filesystems layered over each other making it very lightweight and fast.
If you didn’t have UnionFS, a 200MB image runs 5 times as 5 separates containers would mean 1GB of disk space.
Docker Engine Components
Docker Engine is the layer on which Docker runs. It is installed on the host machine. It’s a lightweight runtime and tooling that manages containers, images, builds, and more.
There are three components in the Docker Engine:
a) Server: It is the docker daemon called dockerd. It can create and manage docker images. i.e. Containers, networks.
b) Rest API: It is used to instruct docker daemon what to do.
c) Command Line Interface (CLI): It is a client that is used to enter docker commands.
Docker Networking | Docker Storage
Networking in Docker is part of docker which is used to connect the docker container to each other and outside world so they can communicate with each other also they can talk to Docker Host. you can connect docker containers to non-Docker workloads. Docker uses CNM Container Network Model for networking.
Note: To know more about Docker networking
Docker Storage By default, all files created inside a container are stored on a writable container layer so the data doesn’t persist when that container no longer exists. Docker has two options for containers to store files in the host machine, so that the files are persisted even after the container stops: volumes, and bind mounts.
Docker Container Lifecycle Management
There are different stages when we create a container which is known as Lifecycle of container i.e create, run, pause, delete & stopped.
- The first phase is the created state. Further, the container moves into the running state while we use the Docker run command.
- we can stop or pause the container, using Docker stop/pause command. And, to put a container back from a stopped state to a running state, we use the Docker run command.
- We can delete a running or stopped container, using rm command.
- [Part 1] Docker vs Virtual Machine | Physical vs Virtual Servers
- [Video] Containers (Docker) & Kubernetes In Azure For Beginners
- Docker Networking & Different Types Of Networking
- Docker Image And Layer Overview For Beginners
Join FREE Masterclass
To know about what is the Roles and Responsibilities of Kubernetes administrator, why you should learn Docker and Kubernetes, Job opportunities for Kubernetes administrator in the market, and what to study Including Hands-On labs you must perform to clear CKA certification Exam by registering for our FREE Masterclass.