Docker is what most of us look up to when it to Containers, right? There definitely seems to be no contradiction on this at least. Even though Containers are not VM replacements, the companies have started to utilize it in that way. Docker uses a client-server architecture. In this blog, I will be covering everything you have to know about Docker Architecture.
The topics I will be discussing are:
- What Is Container?
- What Is Docker?
- Docker Architecture and Components
- Resources Isolation In Docker
- Docker Engine Components
- Docker Networking and Storage
- Docker Container Lifecycle Management
In this video blog, we are covering the Architecture & Components of the Docker and Container lifecycle.
Read: Docker vs Virtual Machine
What Is Container?
Containers are a software package into a logical box with everything that the application needs to run. That includes the operating system, application code, runtime, system tools, system libraries, and etc. Docker containers are built off Docker images. Since images are read-only, Docker adds a read-write file system over the read-only file system of the image to create a container.
Containers are compared with virtual machines (VMs). VMs are the guest operating system such as Linux or Windows runs on top of a host operating system with virtualized access to the underlying hardware. Containers allow you to package your application together with libraries and other dependencies, providing isolated environments for running your software services.
Different Container Providers
- Docker
- Microsoft Azure
- Amazon Web Services (AWS)
- Google Cloud Platform
- Linux Containers
Read: All you need to know on Containers
What is Docker?
Docker is an open-source platform based on Linux containers for developing and running applications inside containers. Docker is used to deploy many containers simultaneously on a given host. Containers are very fast and lightweight because they don’t need the extra load of a hypervisor as they run directly within the host machine’s kernel.
Docker Architecture and 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 Images are 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.
Read: Docker Tutorial
Resource 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 the 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 separate containers would mean 1GB of disk space.
Read: Docker Image Vulnerability Scanning
Docker Engine Components
Docker engine is a part of Docker which create and run the the Docker containers. 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 and 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 Container Network Model (CNM) for networking.
Read: 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.
Storage in Docker has a lot more to learn from, do go through our Docker storage blog.
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 Docker rm command.
Read: Docker Lifecycle
Related Post
- Visit and subscribe to our YouTube channel on “Docker & Kubernetes”
- Container (Docker) vs Virtual Machine
- Docker Images: A Complete Guide For Beginners
- Docker Networking | Introduction to Docker Network
- Kubernetes vs Docker – Understand the Difference
- Certified Kubernetes Administrator (CKA) Certification Exam
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.
Click on the below image to Register Our FREE Masterclass Now!
Leave a Reply