Replacing Docker with Podman – Power of Podman
Tags: showdev, docker, devops, tutorial
Published: 2019-06-21 19:04:10

---
title: Replacing Docker with Podman – Power of Podman
published: true
description: Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System
tags: showdev, docker,devops,tutorial
canonical_url: https://cloudnweb.dev/2019/06/replacing-docker-with-podman-power-of-podman/
---

To Support my work, Read this article from my website. https://cloudnweb.dev/2019/06/replacing-docker-with-podman-power-of-podman/

<!-- wp:paragraph -->
<p>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</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Before going into the article, we will see what Docker it and How Docker works.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>What is Docker ?</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Unlike a virtual machine, Docker container shares the same Linux kernel as the system.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":758} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/docker-containerized-and-vm-transparent-bg-1024x419.png" alt="" class="wp-image-758"/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3>How Docker works ?</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Let us first understand how docker works and we will see how we can overcome the problem of it using podman.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":761} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/docker_flow-1.png" alt="" class="wp-image-761"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>building blocks of docker are <strong>Docker CLI</strong> and <strong>Docker Daemon</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Docker CLI</strong> sends the commands to <strong>Docker Daemon</strong> where <strong>Docker Daemon</strong> push/pull the image from the registry.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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,&nbsp;and the kernel. &nbsp;The Docker command-line interface (CLI) asks the daemon to do this on your behalf. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>you can ask me, what is the problem with it. Actually there are few, </p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li> A single process could be a single point of failure. </li><li> This process owned all the child processes (the running containers). </li><li>If there is any failure in the docker daemon, then every child processes are lost its track.</li><li> Building containers led to security vulnerabilities. </li><li> All Docker operations had to be conducted by a user (or users) with the same full root authority. </li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Here comes the role of podman which solves most of the problem. What is podman anyway?</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>BTW, What is Podman ?</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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) .</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":773} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/podman_flow.png" alt="" class="wp-image-773"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>you can ask me, what is a <strong>runC</strong> Container runtime process ? .</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Above all, <strong>runC</strong>&nbsp;is a lightweight, portable container runtime. Docker is built on top of <strong>runC</strong> runtime container. Instead of using a daemon in podman, we directly use the <strong>runC</strong> runtime container.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below is the diagram to explain how Docker works on top of <strong>runC</strong> container runtime.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":779} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/docker_internals.png" alt="" class="wp-image-779"/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":3} -->
<h3>Migrating from Docker to Podman</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p> Firstly , migrating from Docker to Podman is very easy.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li> You need to install Podman instead of Docker. You do not need to start or manage a daemon process like the Docker daemon. </li><li> The commands that you use with Docker will be the same for Podman. </li><li>Images of Docker is compatible with Podman.</li><li> Podman stores its containers and images in a different place than Docker. </li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Let's see the Podman implementation with an node.js application. you can learn how to containerize a node.js application with docker <a href="https://cloudnweb.dev/2019/04/dockerizing-a-node-js-web-app/">here</a></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Containerizing a node.js application with Podman</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Before building the container image.<a href="https://github.com/containers/libpod/blob/master/install.md"> Install podman</a> in your local machine.make sure you installed podman correctly by running the following command.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ podman --version</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Complete Source code for the application can be found in this <a href="https://github.com/ganeshmani/podman-demo">repo</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Once, you clone the repository in the local machine. Run the following command</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ podman build -t podmandemo .</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Note: If you face any error such as <strong>No Registries is found</strong>. Do the following steps.(Only if you face this error)</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>$ cd /etc/containers/
$ sudo nano registries.conf</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Add <strong>docker.io</strong> in the<strong> [registries.search]</strong> and save the file</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":792} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/Screenshot-from-2019-06-20-11-41-23-1024x701.png" alt="" class="wp-image-792"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now, run the <strong>build</strong> command again</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":795} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/Screenshot-from-2019-06-20-12-00-54.png" alt="" class="wp-image-795"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Once Image built Successfully, run the image with the following command.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":796} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/Screenshot-from-2019-06-20-12-02-03.png" alt="" class="wp-image-796"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>After that, visit the url <strong>http://localhost:3333</strong>. you will see something like</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":797} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/Screenshot-from-2019-06-20-12-02-13-1024x119.png" alt="" class="wp-image-797"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>That's it. Podman runs the image without any daemon process.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":801} -->
<figure class="wp-block-image"><img src="https://cloudnweb.dev/wp-content/uploads/2019/06/clap.gif" alt="" class="wp-image-801"/></figure>
<!-- /wp:image -->