Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Using pods with Podman on Fedora

#1
Using pods with Podman on Fedora

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora.png" width="1024" height="328" title="" alt="" /></div><div><div class="wp-block-jetpack-markdown">
<p>This article shows the reader how easy it is to get started using pods with Podman on Fedora. But what is Podman? Well, we will start by saying that Podman is a container engine developed by Red Hat, and yes, if you thought about Docker when reading container engine, you are on the right track. A whole new revolution of containerization started with Docker, and Kubernetes added the concept of pods in the area of container orchestration when dealing with containers that share some common resources. But hold on! Do you really think it is worth sticking with Docker alone by assuming it’s the only effective way of containerization? Podman can also manage pods on Fedora as well as the containers used in those pods.</p>
</div>
<p> <span id="more-32375"></span> </p>
<blockquote class="wp-block-quote">
<p><a href="http://podman.io">Podman</a> is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (<a href="https://www.opencontainers.org/">OCI</a>) <a href="https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.j2uq93kgxe0e">Containers</a> and <a href="https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.dqlu6589ootw">Container Images</a>.</p>
<p><cite>From the official Podman documentation at http://docs.podman.io/en/latest/</cite></p></blockquote>
<h3><span class="has-inline-color has-black-color">Why should we switch to Podman?</span></h3>
<div class="wp-block-jetpack-markdown">
<p>Podman is a daemonless 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 an image registry, containers and image storage.</p>
</div>
<h3>Install Podman:</h3>
<pre class="wp-block-preformatted">sudo dnf -y install podman</pre>
<h3>Creating a Pod:</h3>
<div class="wp-block-jetpack-markdown">
<p>To start using the pod we first need to create it and for that we have a basic command structure</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman pod create</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="328" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora.png" alt="" class="wp-image-32382" /></figure>
<div class="wp-block-jetpack-markdown">
<p>The command above contains no arguments and hence it will create a pod with a randomly generated name. You might however, want to give your pod a relevant name. For that you just need to modify the above command a bit.</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman pod create --name climoiselle</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="355" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-1.png" alt="" class="wp-image-32383" /></figure>
<div class="wp-block-jetpack-markdown">
<p>The pod will be created and will report back to you the ID of the pod. In the example shown the pod was given the name ‘climoiselle’. To view the newly created pod is easy by using the command shown below:</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman pod list</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="334" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-2.png" alt="" class="wp-image-32385" /><figcaption>Newly created pods have been deployed</figcaption></figure>
<div class="wp-block-jetpack-markdown">
<p>As you can see, there are two pods listed here, one named darshna and the one created from the example named climoiselle. No doubt you notice that both pods already include one container, yet we sisn’t deploy a container to the pods yet.<br />
What is that extra container inside the pod? This randomly generated container is an infra container. Every podman pod includes this infra container and in practice these containers do nothing but go to sleep. Their purpose is to hold the namespaces associated with the pod and to allow Podman to connect other containers to the pod. The other purpose of the infra container is to allow the pod to keep running when all associated containers have been stopped.</p>
<p>You can also view the individual containers within a pod with the command:</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman ps -a --pod</div></div> </pre>
</div>
<figure class="wp-block-image size-large is-resized"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-3.png" alt="" class="wp-image-32395" width="645" height="139" /></figure>
<h3>Add a container</h3>
<div class="wp-block-jetpack-markdown">
<p>The cool thing is, you can add more containers to your newly deployed pod. Always remember the name of your pod. It’s important as you’ll need that name in order to deploy the container in that pod. We’ll use the official ubuntu image and deploy a container using it running the top command.</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman run -dt --pod climoiselle ubuntu top</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="739" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-4.png" alt="" class="wp-image-32409" /></figure>
<h3>Everything in a Single Command:</h3>
<div class="wp-block-jetpack-markdown">
<p>Podman has an agile characteristic when it comes to deploying a container in a pod which you created. You can create a pod and deploy a container to the said pod with a single command using Podman. Let’s say you want to deploy an NGINX container, exposing external port 8080 to internal port 80 to a new pod named test_server.</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman run -dt --pod new:test_server -p 8080:80 nginx</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="348" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-5.png" alt="" class="wp-image-32410" /><figcaption>Created a new pod and deployed a container together</figcaption></figure>
<div class="wp-block-jetpack-markdown">
<p>Let’s check all pods that have been created and the number of containers running in each of them …</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman pod list</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="341" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-6.png" alt="" class="wp-image-32411" /><figcaption>List of the containers, their state and number of containers running into them</figcaption></figure>
<div class="wp-block-jetpack-markdown">
<p>Do you want to know a detailed configuration of the pods which are running? Just type in the command shown below:</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">podman pod inspect [pod's name/id]</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="808" height="1024" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-7.png" alt="" class="wp-image-32392" /></figure>
<h3>Make it stop!</h3>
<div class="wp-block-jetpack-markdown">
<p>To stop the pods, we need to use the name or ID of the pod. With the information from podman’s pod list command, we can view the pods and their infra id. Simply use podman with the command stop and give the particular name/infra id of the pod.</p>
<pre> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ podman pod stop climoiselle</div></div> </pre>
</div>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="279" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-8.png" alt="" class="wp-image-32412" /></figure>
<h3>Hey take a look!</h3>
<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="362" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/12/using-pods-with-podman-on-fedora-9.png" alt="" class="wp-image-32413" /><figcaption>My pod climoiselle stopped</figcaption></figure>
<div class="wp-block-jetpack-markdown">
<p>After following this short tutorial, you can see how quickly you can use pods with podman on fedora. It’s an easy and convenient way to use containers that share resources and interact together.</p>
</div>
<h3>Further reading</h3>
<p>The fedora Classrom article <a href="https://fedoramagazine.org/fedora-classroom-containers-101-podman/">https://fedoramagazine.org/fedora-classroom-containers-101-podman/</a>. A good starting point for beginners <a href="https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/">https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/</a>. An article on capabilities and podman <a href="https://fedoramagazine.org/podman-with-capabilities-on-fedora/">https://fedoramagazine.org/podman-with-capabilities-on-fedora/</a>. Podman’s documentation site <a href="http://docs.podman.io/en/latest/">http://docs.podman.io/en/latest/</a>.</p>
</div>


https://www.sickgaming.net/blog/2020/12/...on-fedora/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016