Cheat Sheet

Podman Cheat Sheet

Bob Reselman
February 22, 2022
Podeman

Get the cheat sheet

About

Podman is a daemonless container engine for developing, managing, and running Open Container Initiative (OCI) containers on Linux systems. Included in Red Hat Enterprise Linux 7.6 and later, Podman lets you create and manage rootless containers, which don't require root access to be built and deployed.

Podman is an excellent alternative to Docker containers when you need increased security, unique identifier (UID) separation using namespaces, and integration with systemd.

Download the Podman Cheat Sheet and explore basic commands for managing images, containers, and container resources. You’ll learn how to:

  • Work with image repositories
  • Build container images
  • Create and run containers
  • Manage container processes and resources
  • Work with a host compiler’s file system

With Red Hat Developer cheat sheets, you get essential information right at your fingertips so you can work faster and smarter. Easily learn new technologies and coding concepts and quickly find the answers you need.

Excerpt

Working with containers

The following sections describe the Podman commands for creating and running containers.

podman run

podman run [options] <repo>/<image>:<tag>

Runs a container based on a given <image>:<tag> pair. If the image exists on the local machine, that image will be used. Otherwise, podeman attempts to get the container image from the remote repository specified in the command.

Example:

The following example runs a container using the latest version of the container image for the distributed tracing tool zipkin that is stored in the quay.io container repository. The -doption runs the container in the background in order to free the terminal window to accept future input. The output from podman run is the container's UUID.

Then, the command podman ps -a lists the running containers. Because the zipkin container was not assigned a name when it was created, the arbitrary name laughing_mahavira is assigned to the container:

$ podman run -d quay.io/openzipkin/zipkin

ea35aa9eda875dd0c3ea34beb6216cf1148725272f28829ea1d3ba262f9f2ada

$ podman ps -a CONTAINER ID  IMAGE        COMMAND     CREATED    STATUS         PORTS    NAMES

 

The following example creates and runs the container using the nginx:latestcontainer image. The -d option runs the container in the background. The --name option gives the container the name mywebserver .

After the container is created, the podman ps -a command lists the containers running on the local machine. Note that the lists the containers running on the local machine. Note that the nginx container has the name mywebserver.

$ podman run -d --name mywebserver -it nginx:latest
$ podman ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ea35aa9eda87 quay.io/openzipkin/zipkin:latest 6 min ago Up 6 min ago laughing_mahavira
e90ac3eb5f5a6 docker.io/library/nginx:latest nginx -g... 4 sec ago Up 4 sec ago mywebserver

 

Comments