<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Chetanya Kandhari</title>
    <description>The latest articles on Forem by Chetanya Kandhari (@availchet).</description>
    <link>https://forem.com/availchet</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F414284%2Fedc99b7c-0ee6-42c5-ab00-aaf473b3271b.png</url>
      <title>Forem: Chetanya Kandhari</title>
      <link>https://forem.com/availchet</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/availchet"/>
    <language>en</language>
    <item>
      <title>Podman - as an alternative to Docker?</title>
      <dc:creator>Chetanya Kandhari</dc:creator>
      <pubDate>Tue, 21 Jul 2020 07:16:50 +0000</pubDate>
      <link>https://forem.com/availchet/podman-as-an-alternative-to-docker-592f</link>
      <guid>https://forem.com/availchet/podman-as-an-alternative-to-docker-592f</guid>
      <description>&lt;p&gt;Last year, I had a chance to explore &lt;code&gt;podman&lt;/code&gt; as an alternative to &lt;strong&gt;Docker&lt;/strong&gt;. Here are some of my thoughts.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that some of the content of this post may be outdated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;docker-ce&lt;/code&gt; is not officially supported in Redhat.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker-ee&lt;/code&gt; is supported but the pricing is expensive.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;One alternative is to install &lt;code&gt;centos&lt;/code&gt; repo for docker. But the support would not be available from Redhat.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Another alternative would be to use Podman for running and building containers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Podman is a &lt;code&gt;daemonless&lt;/code&gt; container engine for developing, managing, and running OCI Containers on your Linux System.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers under the control of Podman can either be run by root or by a non-privileged user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Podman provides a Docker-compatible command-line front end that can simply alias the Docker CLI, &lt;code&gt;alias docker=podman&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Podman is a replacement for the Docker CLI, not the Docker engine API.&lt;/em&gt; They do have podman varlink for a remote API, but it does not follow the Docker API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Podman does not support &lt;em&gt;docker-compose&lt;/em&gt;, which needs to communicate with the docker socket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Ansible provides &lt;code&gt;docker_container&lt;/code&gt; and &lt;code&gt;docker_image&lt;/code&gt; modules.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can start docker containers in the remote host using an Ansible script.&lt;/li&gt;
&lt;li&gt;This also requires the docker socket and does not work with Podman.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Podman provides an interesting feature called &lt;code&gt;pod&lt;/code&gt;. It is similar to a Kubernetes pod.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basically, a pod is a group of containers that run on a single machine and share network, ports etc.&lt;/li&gt;
&lt;li&gt;All pods have a container caller infra container, which exposes the ports for the pod and sleeps.&lt;/li&gt;
&lt;li&gt;Containers can be added to a pod and container from a pod can be stopped and restarted once the pod is created as long as the infra container is running.&lt;/li&gt;
&lt;li&gt;Containers added to a pod cannot expose any ports, since these are exposed by the infra container. If you need to expose any additional ports, you need to remove and recreate a pod.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Podman provides a &lt;strong&gt;podman play&lt;/strong&gt; command, which allows you to play containers and pods bases on structured text input (yaml file)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;podman play kube&lt;/code&gt; subcommand allows running pods and containers using a kubernetes yaml.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kompose&lt;/strong&gt; is a tool that allows generating kubernetes yaml through a docker-compose file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unfortunately, podman only allows playing kubernetes yaml generated by podman.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Podman provides a &lt;code&gt;podman generate kube&lt;/code&gt; command that generates the kubernetes yaml from running pods.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One can translate docker-compose to a set of docker run commands to start the containers manually, providing all environment variables.&lt;/li&gt;
&lt;li&gt;If you are running them from inside a pod, then you don’t need to specify ports. In fact, the container won’t start if you try to expose a port from a container inside a pod.&lt;/li&gt;
&lt;li&gt;Then once all containers are started, one can generate the kubernetes yaml to play it on any machine.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;An interesting feature of docker-compose is that it sets up a single network for your app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What this means is that each container is in the same network and can be referenced by other containers using a hostname set to the container name.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;For a similar behavior using docker run commands, you can create a docker network.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This allows containers in the same network to be able to reference each other in a similar fashion.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Unfortunately, the &lt;code&gt;docker network&lt;/code&gt; commands are not supported by Podman yet. Although, there is a feature request for it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For a similar feature in podman, you can give each container a static IP using &lt;code&gt;--ip&lt;/code&gt; in podman run. And then use &lt;code&gt;--add-host&lt;/code&gt; to provide a hostname to another container.&lt;/li&gt;
&lt;li&gt;Another alternative is to add all containers to a single pod. Then you will be able to reference all containers using localhost. Although --add-host might still work if you need it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  References:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://podman.io/whatis.html"&gt;https://podman.io/whatis.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/containers/libpod/"&gt;https://github.com/containers/libpod/&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/"&gt;https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://opensource.com/article/18/10/podman-more-secure-way-run-containers"&gt;https://opensource.com/article/18/10/podman-more-secure-way-run-containers&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/muayyad-alsadi/podman-compose"&gt;https://github.com/muayyad-alsadi/podman-compose&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.redhat.com/en/blog/why-red-hat-investing-cri-o-and-podman"&gt;https://www.redhat.com/en/blog/why-red-hat-investing-cri-o-and-podman&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods/"&gt;https://developers.redhat.com/blog/2019/01/15/podman-managing-containers-pods/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>kubernetes</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
