Before diving into Docker itself, it's important to understand why developers created it in the first place. Like any great tool, Docker solves specific problems. Have you ever worked on a project where everything worked on your machine, but failed on someone else's? Docker solves this problem. Over time, developers and organizations faced several challenges in software deployment and infrastructure management. Some of the key issues that led them to create Docker include:
To solve this problem, developers introduced the concept of containerization. Containerization packages an app along with everything it needs to function. This entire package becomes a container, and it acts as a standalone unit. Unlike virtual machines, containers share the host system's operating system, which makes them more efficient and faster to start. You can run these containers anywhere—whether it's a laptop or a cloud server—without compatibility issues. Developers use tools like Docker, Podman, CRI-O, RKT, OpenVZ, and LXC to create containers. However, in this series of articles, we will focus only on Docker.
Before diving into the differences, let’s first understand virtual machines. A virtual machine (VM) works like a computer inside our computer; it functions as a fully operating real computer with a virtual CPU, memory, and hard drives. The host computer runs a software layer called a hypervisor. It creates and manages these virtual environments. VMs let us run a different operating system or test programs without affecting our main computers.
As mentioned earlier, we discuss Docker in this series because it is one of the popular containerization tools.
Docker is an open-source platform for developing, deploying, and running applications using lightweight portable software containers. These containers act as standalone and executable software units that include everything needed to run.
Let's break this down to avoid diving too deep into technical details. Think of it like organizing a party. You make a list of items like food, drinks, plates and cups, music, and decorations. You planned to host the party at a small private hotel, but the hotel suddenly informed you that the place was reserved for another party. So you decided to celebrate the party at the office instead. Instead of buying everything again, you hired a catering service. They brought everything needed to start the party. Docker works the same way as the catering service. When you tell it what you need, it packs and delivers it all. In Docker, developers pack the app and everything it needs into a container. Whether you run it on a personal laptop, office laptop, or even a cloud service, the app runs without extra setup.
Docker follows a client-server architecture where different components work together to create, manage, and run containers. which include followings,
The Docker Daemon (dockerd) serves as the heart of Docker. It runs as a background service on our machines. It handles all container-related actions such as building, running, and managing containers. When the Docker Client sends commands, the Daemon processes them, creates or stops containers, and manages Docker objects. It acts as the engine that keeps everything running smoothly.
The Docker Client is the part of Docker that we directly interact with. It’s a command-line tool where you type commands like docker run, docker pull, or docker build. These commands go to the Docker Daemon, which does the heavy lifting. The client and daemon can run on the same machine, or you can use the client to communicate with a remote daemon.
Docker images live in a registry. Docker Hub is the most well-known public registry where many images are available for public use. You can also create your own private registry to store organization-specific images like Amazon Elastic Container Registry (ECR), Google Container Registry (GCR), or Azure Container Registry. When you run a docker pull command, the client contacts the registry to download the image. And when you use docker push, you upload your custom images to a registry.
Docker objects are the core components we use when developing, shipping, and running our applications in containers. Among these objects, images and containers are the most essential ones to understand. Let's talk about Docker Images and Containers.
Before diving deeper into Docker, let's get a quick overview of the things you can do with it in the real world:
Now, let's move on to the installation process. You can use the following links to download and set up Docker Desktop: