Docker Introduction, Architecture, and Command Details
Its primary focus is to automate the deployment of applications inside software containers and the automation of operating system-level virtualization on Linux.
Join the DZone community and get the full member experience.Join For Free
Its primary focus is to automate the deployment of applications inside software containers and the automation of operating system-level virtualization on Linux. It’s more lightweight than standard containers and boots up in seconds.
Why Does Docker Come Into the Picture?
Before Docker, all of us faced many issues. For example, when we built the application and after testing all the scenarios, we passed them to the QA environment, and then on the machines of QA members, we needed to take care of all the dependencies and versions of assemblies and frameworks. So there is a gap between the QA and the development team, and it also wastes time. So, when we use Docker, this problem will get sorted, and we can use Docker Images on any platform without too much configuration.
Docker uses a client-server architecture. The Docker Client connects with the Docker Daemon, which runs and builds the Docker containers. The Docker client and Docker daemon are running 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.
The Docker daemon is the brain behind the whole operation. When you use the docker run command to start up a container, your Docker client will translate that command into an HTTP API call and send it to the Docker daemon. The Docker daemon then evaluates the request, talks to the underlying OS, and provisions your container.
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 the 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 is an easy-to-install application for your Mac or Windows environment that enables you to build and share containerized applications and microservices. The Docker Desktop includes the Docker daemon, the Docker client, Docker Compose, and Kubernetes.
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 is 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.
When you use Docker, you create and use images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.
A Docker image is a read-only template containing 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.
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 the memory to use it and CPU cores for each instance of your app. Just like any other app, when a container needs 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 of the basics of Docker and how it works.
Published at DZone with permission of Jaydeep Patil. See the original article here.
Opinions expressed by DZone contributors are their own.