Docker Introduction, Architecture, and Command Details

Docker Overview

Its primary focus is to automate the deployment of applications insiding software containers and the automation of operating system level virtualization in Linux. It's more lightweight than standard Containers and boots up in seconds.

Why Docker Comes into the Picture

Before Docker all of us faced many issues, like when we built the application and after testing all scenarios, we passed that to the QA environment and then on the machine of QA members we needed to take care of all the dependencies and version of assemblies and framework. So due to this, there was a gap between the QA and Development team and also time was wasted. So, when we use Docker, this problem gets sorted out. We canuse Docker Image on any platform without too much configuration.

Docker Architecture

Docker uses a Client-Server architecture. The Docker Client connects with Docker Daemon, which runs and builds the Docker containers. The Docker client and Docker daemon run on the same host, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over a network interface.

Docker Architecture

Docker Daemon

Docker daemon is the brain behind the whole operation. When you use docker runcommand to start up a container, your docker client will translate that command into http API call, send it to docker daemon, Docker daemon then evaluates the request, talks to underlying OS and provisions your container.

Docker Client

The Docker client is used by users who interact with Docker. When you use commands such as docker run, the client sends these commands to Docker Daemon, which takes care of that. The Docker command uses the Docker API. The Docker client can communicate with more than one daemon.

Docker Desktop

Docker Desktop is an easy-to-install application for your Mac or Windows environment that enables you to build and share containerized applications and microservices. Docker Desktop includes the Docker daemon, the Docker client, Docker Compose, Kubernetes.

Docker Registries

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. If you want to create your own directory then that also possible.

When you use the docker pull or docker run commands, the required images are pulled from your configured registry. When you use the docker push command, your image is pushed to your configured registry.

Docker Objects

When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.

Images

A Docker image is a read-only template that contains a set of instructions for creating a container that can run on the Docker platform. It provides a convenient way to package up applications and preconfigured server environments, which you can use for your own private use or share publicly with other Docker users.

Containers

A container is a way to run applications that are isolated from each other. Rather than virtualizing the hardware to run multiple operating systems, containers rely on virtualizing the operating system to run multiple applications. This means you can run more containers on the same hardware than VMs because you only have one copy of the OS running, and you do not need to the memory before use of it and CPU cores for each instance of your app. Just like any other app, when a container needs the CPU or Memory, it allocates them, and then frees them up when done, allowing other apps to use those same limited resources later.

I hope you understand some basics of Docker and how it works.