How to deploy a pod with Podman

Master how to get a lot more flexibility and effectiveness out of Podman by making use of pods to regulate your containers.

Podman is the new container deployment engine for CentOS 8 and RHEL 8. While it has the same aim as the Docker engine (deploying and taking care of containers), it does so in a incredibly different way–at the very least underneath the hood. From the person standpoint, it’s fairly equivalent to Docker in how it functions. 

For the most portion.

Certainly, you pull photographs and deploy containers in the exact vogue as you do with the Docker engine. But, Podman has a few of new methods up its sleeve. A person this sort of trick is pods. Pods are a team of a person or additional containers that function jointly. Think of pods as a way to team linked containers collectively for less difficult administration (this kind of as a WordPress container and its necessary MySQL databases container managed from a one pod). Since Podman deploys each and every container as its own course of action, this can be a incredibly effective and simple way of developing interconnected containers.

I want to wander you via the approach of deploying a pod with Podman on CentOS 8.

SEE: Hiring package: Database administrator (TechRepublic Premium)

What you can expect to need

The only matters you can require to deploy your 1st Podman pod are:

To obtain out how to install Podman on CentOS 8, see: How to set up the Podman container engine on CentOS 8.

How to generate a new pod

The first issue to be done is the development of a new pod. The command to generate a new pod is:

podman pod develop

You can expect to know if the pod was productively produced when the command returns an ID for the new pod (Determine A).

Determine A


Our new pod has been developed.

That will develop a incredibly primary pod. You can build a pod applying a quantity of solutions, these types of as:

  • –cgroup-mother or father benefit – Established the parent cgroup for the pod

  • –infra – Produce an infra container linked with the pod that will share namespaces

  • –infra-command benefit – A command that will be operate on the infra container when the pod is begun (this kind of as “/pause”)

  • –infra-image benefit – The infra container impression to be related with the pod

  • –label price – Set metadata for a pod

  • –label-file price – Set the metadata for a pod from a line-delimited file of labels

  • –identify benefit – Assign a name to the new pod

  • –pod-id-file price – Compose the pod ID to a file

  • –publish worth – Publish a container’s port (or a assortment of ports) to the host

  • –share value – A comma-delimited checklist of kernel namespaces to be shared with

Checklist the recently developed pod with the command:

podman pod list

The listing of the pod (Determine B) will have the random name designed for the pod. You may need to have that title in order to incorporate a container to this pod.

Determine B


You will also recognize the new pod includes a solitary infra container. This new container was randomly designed for the pod. You can list that container with the command:

podman ps -a --pod

The output of that command will listing any containers that have been deployed with out sudo privileges (so it will contain the random container inside of our new pod).

How to add a container to the pod

Following, we’ll incorporate a container to the newly deployed pod. Notice: You are going to want that randomly assigned identify (or the identify you gave the pod working with the –identify alternative). In my example, the pod name is silly_bhabha. Let us use the formal Ubuntu impression to deploy a container to the new pod. This container will run the leading command, although we will not likely see the output of that command. 

To deploy that container to the pod, the command would be:

podman operate -dt --pod foolish_bhabha ubuntu major

We really should now see our pod has a lot more than 1 container, using the command:

podman pod ps

In the listing (Determine C), you will see the variety of containers is three.

Determine C


The foolish_bhabha pod now has 3 containers.

To view the individual containers, problem the command:

podman ps -a --pod

In the element listing, you can expect to see the command that every container is operating (Figure D).

Figure D


The specifics for unique containers.

It is also probable to build a new pod and deploy a container to it with a single command. Say you want to deploy an nginx container, exposing external port 3100 to inner port 80, to a new pod named trtest. That command would be:

podman run -dt --pod new:trtest -p 31000:80 nginx

The output will record the newly developed container ID. You can incorporate a lot more containers to this pod in the very same trend as we did earlier. Look at to make certain the newly designed pod is completely ready with the command:

podmand pod record

As you can see (Determine E), our new trtest pod has been established and includes far more than just the random container.

Determine E


Our new trtest pod is prepared.

To halt a pod and all involved containers, you have to initial obtain it truly is ID. To that, problem the command:

podman ps -p

The ID will be mentioned underneath the POD column (Figure F).’

Figure F


End the pod with the command:

podman cease ID

Wherever ID is the to start with 4 figures of the pod ID.

To restart a pod and all linked containers, issue the command:

podman begin ID

Wherever ID is the very first 4 figures of the pod ID.

And that’s the gist of deploying a pod with podman. There is, of training course, considerably much more to be learned about handling pods with Podman, but this will get you commenced.

Also see

Fibo Quantum