Docker Vs Podman

A whole new revolution of containerization started with the Docker where the daemon process manages the whole bunch of things and became one of the most popular and widely used container management systems.

But. Hold on! Do you really think it is worth sticking to the Docker by assuming it’s the only effective way of containerization?

This blog post will help you with such questions like:

Why would we not use Docker? Why would we use Docker? Are there no alternatives to it ? and when you will start using new set of tools for container management , docker will be just another tool and there is no “docker containers/images” but just “containers/images”

Before taking this blog further we will see what Docker is and how it does works.

What is Docker?

Docker is a containerization stage where we can bundle our application with its libraries and conditions inside that container. Docker Container is a to some degree like a virtual machine.
but yeah…

Unlike virtual machines where hardware is virtualized, In Docker, the containers running share the host OS kernel .

Working of Docker? Let’s see:

Docker Flow:

Two main blocks of docker are : Docker Daemon and Docker CLI .

let me explain in short :

Docker Daemon: A constant background process that helps to manage/create Docker images, containers, networks, and storage volumes.

Docker Engine REST API: An API used by applications to interact with the Docker daemon; it can be accessed by an HTTP client.

Docker CLI: A Docker command line client for interacting with the Docker daemon. a.k.a the Docker command.

If we think differently we could just connect some problems with Docker:

  • As we all know Docker runs on a single process it could result into single point of failure.
  • All the child processes are owned by this process.
  • At any point if Docker daemon fails, all the child process losses their track
    and enters into orphaned state.
  • Security vulnerabilities.
  • All the steps needs to be performed by root for Docker operations.

Now we know how Docker works, let’s come to the main topic about Podman

And how we can overcome on most of the problems associated with containers.

So, you must be wondering “What is Podman?”

  • Podman is a daemon-less container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode.
  • Podman directly interacts with Image registry, containers and image storage.
  • As we know Docker is built on top of runC runtime container and uses daemon, Instead of using daemon in Podman, it is directly using runC runtime container.

There are a few things to unpack about podman

  • No need to start or manage a daemon process like the Docker daemon.

The commands which works with Docker works the same for Podman.
alias docker=podman

  • There is Compatibility between Podman and Docker images.

Cool… Isn’t it??

Getting Started With Podman

Installing podman on CentOS 8

[cloudbunny@technopanti ~]$ yum install podman

Once you install the podman you can check version using

[cloudbunny@technopanti ~]$ podman –version

Output : podman version 1.6.4

Running a sample container

[cloudbunny@technopanti ~]$ podman run -dt -p 8080:8080/tcp -e HTTPD_VAR_RUN=/var/run/httpd -e HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d
> -e HTTPD_MAIN_CONF_PATH=/etc/httpd/conf
> -e HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/
> registry.fedoraproject.org/f29/httpd /usr/bin/run-httpd

Because the container is being run in detached mode, represented by the -d in the podman run command, Podman will print the container ID after it has run. Note that we use port forwarding to be able to access the HTTP server.

Note:

  1. -d represents detached mode.

2. Podman will print the container ID after it has run.
(example:487a4c7f805d99260b65973f224dba11631800186aae38c7b8dd6907ebfdb028)

3. -p: Port forwarding is used to be able to access the HTTP server.

Listing running containers

[cloudbunny@technopanti ~]$ podman ps

Inspecting a running container

[cloudbunny@technopanti ~]$ podman inspect –l

This will help to “inspect” a running container for metadata and details about itself.
status : running/ stopped , date of creation , container ID , etc.

Since we have a detail of container we can test our http server , in this example the port fowarding is done on port : 8080

[cloudbunny@technopanti ~]$ curl http://localhost:8080

the above command will display the index page of our containerized httpd server.

Viewing the container’s logs

[cloudbunny@technopanti ~]$ podman logs –latest

Hope you enjoyed reading it 🙂

Leave a Comment

Your email address will not be published. Required fields are marked *