Yeah, you read it right... while Docker is a buzzword in the tech industry now. we will see the consequences of using it and how we can solve the problem with Podman. Replacing Docker with Podman - Power of Podman
Recent Article on Podman,
Before going into the article, we will see what Docker it and How Docker works.
Docker is a containerization platform where we can package our application with its libraries and dependencies inside the container. Docker Container is a somewhat like a virtual machine.
Unlike a virtual machine, Docker container shares the same Linux kernel as the system.
Let us first understand how docker works and we will see how we can overcome the problem of it using podman.
building blocks of docker are Docker CLI and Docker Daemon.
Docker CLI sends the commands to Docker Daemon where Docker Daemon push/pull the image from the registry.
Daemon makes the copy of images in the local container and maintains it. Essentially the Docker daemon does all the work with registries, images, containers, and the kernel. The Docker command-line interface (CLI) asks the daemon to do this on your behalf.
you can ask me, what is the problem with it. Actually there are few,
Here comes the role of podman which solves most of the problem. What is podman anyway?
Most importantly, there is no concept called daemon in podman. podman directly interact with Image registry, containers and image storage. with Linux kernel through the runC container runtime process (not a daemon) .
you can ask me, what is a runC Container runtime process ? .
Above all, runC is a lightweight, portable container runtime. Docker is built on top of runC runtime container. Instead of using a daemon in podman, we directly use the runC runtime container.
Below is the diagram to explain how Docker works on top of runC container runtime.
Firstly , migrating from Docker to Podman is very easy.
Let's see the Podman implementation with an node.js application. you can learn how to containerize a node.js application with docker here
Before building the container image. Install podman in your local machine.make sure you installed podman correctly by running the following command.
1$ podman --version
Complete Source code for the application can be found in this repo
Once, you clone the repository in the local machine. Run the following command
1$ podman build -t podmandemo .
Note: If you face any error such as No Registries is found. Do the following steps.(Only if you face this error)
1$ cd /etc/containers/2$ sudo nano registries.conf
Add docker.io in the [registries.search] and save the file
Now, run the build command again
Once Image built Successfully, run the image with the following command.
After that, visit the url http://localhost:3333. you will see something like
That's it. Podman runs the image without any daemon process.