Podman cheat Sheet

A handy Podman cheat sheet, documenting for self reference.

Basic Podman Options

To check the current installed version of podman.

$ podman version
$ podman --version   # Only to print the podman version.
[root@node1 ~]# podman version
Client:       Podman Engine
Version:      4.0.2
API Version:  4.0.2
Go Version:   go1.18.4

Built:      Tue Nov  8 22:30:52 2022
OS/Arch:    linux/amd64
[root@node1 ~]#

Print everything about podman in this server.

$ podman info
$ podman system info
[root@node1 ~]# podman info 
  arch: amd64
  buildahVersion: 1.24.4
  - cpuset
  - cpu
  - cpuacct

The long output has been truncated.

If we need to know podman disk usage

$ podman system df
[root@node1 ~]# podman system df
TYPE           TOTAL       ACTIVE      SIZE        RECLAIMABLE
Images         0           0           0B          0B (0%)
Containers     0           0           0B          0B (0%)
Local Volumes  0           0           0B          0B (0%)
[root@node1 ~]# 

Searching for a Image

Looking for a container image using name.

$ podman image search httpd
[root@node1 ~]# podman image search httpd
NAME                                                                         DESCRIPTION
registry.access.redhat.com/rhscl/httpd-24-rhel7                              Apache HTTP 2.4 Server
registry.access.redhat.com/ubi8/httpd-24                                     Platform for running Apache httpd 2.4 or building httpd-based application

Searching for container image with tags

$ podman image search nginx --list-tags
[root@node1 ~]# podman image search nginx --list-tags
NAME                     TAG
docker.io/library/nginx  1
docker.io/library/nginx  1-alpine
docker.io/library/nginx  1-alpine-perl
docker.io/library/nginx  1-perl
docker.io/library/nginx  1.10
docker.io/library/nginx  1.10-alpine
docker.io/library/nginx  1.10.0
docker.io/library/nginx  1.10.0-alpine

Print only official images and limit to 3 numbers of output.

$ podman image search --filter=is-official --limit 3 nginx
[root@node1 ~]# podman image search --filter=is-official --limit 3 nginx
NAME                     DESCRIPTION
docker.io/library/nginx  Official build of Nginx.
[root@node1 ~]# 

Pulling container Images

To download the container image user pull options by following arguments.

$ podman pull registry.access.redhat.com/ubi9/httpd-24

All tagged images in the repository will be pulled, usually we don’t do this in production.

$ podman pull httpd --all-tags

All other available options

--arch ARCH            
--authfile string      
--cert-dir Pathname    
--creds Credentials    
--os OS                
--platform string      
--variant string       

Listing Container Images

To list all the downloaded container images in local server use

$ podman image list
$ podman image ls
$ podman images  # List images in local storage

Check if an image exists in local storage

$ podman image exists registry.access.redhat.com/ubi9/httpd-24
$ podman image exists httpd-24

Check history of the container image

$ podman image history httpd-24

To Inspect an Image

$ podman image inspect httpd-24

Print an image layers in tree structure

[root@node1 ~]# podman image tree httpd-24
Image ID: 4afe283d911a
Tags:     [registry.access.redhat.com/ubi9/httpd-24:latest]
Size:     378.8MB
Image Layers
├── ID: 51dc345f72f6 Size: 219.4MB
├── ID: 54e043edb782 Size: 55.63MB
└── ID: ff2f095c117d Size: 103.8MB Top Layer of: [registry.access.redhat.com/ubi9/httpd-24:latest]

[root@node1 ~]#

Will add more on the fly.