How to deploy a pod with Podman

Learn how to get extra flexibility and performance out of Podman by utilizing pods to management your containers.

Podman is the new container deployment engine for CentOS 8 and RHEL 8. Whilst it has the identical intention as the Docker engine (deploying and handling containers), it does so in a pretty diverse way–at the very least less than the hood. From the user viewpoint, it is really rather comparable to Docker in how it works. 

For the most aspect.

Indeed, you pull photos and deploy containers in the exact style as you do with the Docker motor. But, Podman has a pair of new methods up its sleeve. A single these types of trick is pods. Pods are a group of one particular or far more containers that run with each other. Think of pods as a way to team relevant containers alongside one another for much easier administration (these types of as a WordPress container and its needed MySQL databases container managed from a one pod). Due to the fact Podman deploys every container as its possess procedure, this can be a quite successful and easy way of creating interconnected containers.

I want to walk you as a result of the method of deploying a pod with Podman on CentOS 8.

SEE: Choosing package: Databases administrator (TechRepublic Premium)

What you may require

The only points you will have to have to deploy your to start with Podman pod are:

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

How to create a new pod

The 1st thing to be carried out is the development of a new pod. The command to make a new pod is:

podman pod build

You can know if the pod was efficiently produced when the command returns an ID for the new pod (Figure A).

Figure A

podmana-2.jpg

Our new pod has been produced.

That will produce a extremely fundamental pod. You can make a pod using a selection of possibilities, this kind of as:

  • –cgroup-father or mother benefit – Set the guardian cgroup for the pod

  • –infra – Make an infra container involved with the pod that will share namespaces

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

  • –infra-image value – The infra container picture to be connected with the pod

  • –label worth – Set metadata for a pod

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

  • –title price – Assign a name to the new pod

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

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

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

List the freshly created pod with the command:

podman pod checklist

The listing of the pod (Figure B) will comprise the random title established for the pod. You may require that identify in buy to increase a container to this pod.

Figure B

podmanb-2.jpg

You will also detect the new pod has a solitary infra container. This new container was randomly created for the pod. You can list that container with the command:

podman ps -a --pod

The output of that command will checklist any containers that have been deployed without having sudo privileges (so it will consist of the random container within our new pod).

How to increase a container to the pod

Following, we are going to insert a container to the newly deployed pod. Observe: You may need to have that randomly assigned identify (or the title you gave the pod employing the –name solution). In my instance, the pod title is foolish_bhabha. Let us use the formal Ubuntu impression to deploy a container to the new pod. This container will operate the top rated command, nevertheless we will not see the output of that command. 

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

podman operate -dt --pod silly_bhabha ubuntu best

We really should now see our pod has additional than a person container, using the command:

podman pod ps

In the listing (Determine C), you can expect to see the variety of containers is 3.

Determine C

podmanpodc-2.jpg

The foolish_bhabha pod now has three containers.

To view the personal containers, issue the command:

podman ps -a --pod

In the depth listing, you’ll see the command that each container is operating (Determine D).

Determine D

podmanpodd-2.jpg

The details for specific containers.

It is also attainable to make 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 inside 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 listing the freshly made container ID. You can incorporate additional containers to this pod in the very same trend as we did previously. Examine to make sure the freshly created pod is completely ready with the command:

podman pod list

As you can see (Figure E), our new trtest pod has been developed and consists of additional than just the random container.

Figure E

podmanpode-2.jpg

Our new trtest pod is prepared.

To stop a pod and all associated containers, you must first uncover it truly is ID. To do that, challenge the command:

podman ps -p

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

Figure F

podmanpodf-2.jpg

Cease the pod with the command:

podman stop ID

Where by ID is the to start with 4 figures of the pod ID.

To restart a pod and all related containers, problem the command:

podman get started ID

In which ID is the initial 4 characters of the pod ID.

And that is the gist of deploying a pod with podman. There is, of course, considerably far more to be acquired about managing pods with Podman, but this will get you begun.

Also see

Fibo Quantum