In this article, I am going to show some basic podman commands for provisioning containerized services. podman is an open-source utility to create, manage images and containers and communication with image registries. Podman is like the same command pattern as the Docker CLI having and nice features in it like it uses OCI images ( Open Container Initiative ). It can store local images in a local file system and avoiding unnecessary client/server arch. It also supports Kubernetes.

1. podman info

info command will show system information such as host architecture, CPU, operating system distribution, registries, storage configuration container storage path, and other information.

 # podman info 
[techtransit@www ~]$ podman info
host:
  arch: amd64
  buildahVersion: 1.18.0
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.27-1.fc32.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.27, commit: 253f230b3f653ff8ed47efbfffa52f0ae3f1820d'
  cpus: 4
  distribution:
    distribution: fedora
    version: "32"
...
...
...
GoVersion: go1.14.10
  OsArch: linux/amd64
  Version: 2.2.1

2. podman search

An application runs in a container needed a container image, which is a file system bundle providing dependency on the application needed to run. Images of containers can be kept in images registries, which can be in local or remote registries. so the podman search command will find available images in local as well on remote registries.

 # podman search image_name

through below podman search command i am filtering official image from container registery , if you want to list all images then you can directly type image name without filter option.

 # podman search --filter is-official=true nginx

3. Fetching images

After the search in registries, the images can be downloaded through the podman pull subcommand. Its downloads and saves it locally for further use. Here I have taken the example of Nginx web server container image name.

 # podman pull container_image_name 
 # podman pull nginx 
[techtransit@www ~]$ podman search --filter is-official=true  nginx
INDEX      NAME                     DESCRIPTION               STARS   OFFICIAL  AUTOMATED
docker.io  docker.io/library/nginx  Official build of Nginx.  15121   [OK]      
[techtransit@www ~]$ podman pull nginx
Completed short name "nginx" with unqualified-search registries (origin: /etc/containers/registries.conf)
Trying to pull registry.fedoraproject.org/nginx:latest...
  manifest unknown: manifest unknown
Trying to pull docker.io/library/nginx:latest...
Getting image source signatures
Copying blob 5430e98eba64 done  
Copying blob 03e6a2452751 done  
Copying blob edb81c9bc1f5 done  
Copying blob b21fed559b9f done  
Copying blob b82f7f888feb done  
Copying blob b4d181a07f80 done  
Copying config 4f380adfc1 done  
Writing manifest to image destination
Storing signatures
4f380adfc10f4cd34f775ae57a17d2835385efd5251d6dfe0f246b0018fb0399

4. Listing images

After pulling the image from the registry podman save the images locally and through podman images subcommands, the images can be listed.

 # podman images 

5. podman inspect

podman inspect command shows metadata about container image and running or stopped container. The result of this command is produced output in the JSON format.

 # podman inspect image_id/repository 

6. Runs a container

To runs, containers podman run command executes and it runs a container based on local download image. The run subcommand generates a unique random ID and it can also generate different container names if not specified in the run subcommand.

Below is sample command to run ubuntu container image and it show hello output after run the container.

 # podman run ubuntu echo 'Hello!' 

7. podman ps

podman ps displays all active running containers, it shows the container’s unique ID and name of the containers. Container id is unique and system generated. Container name can be different because it can be specified through run subcommand.

Below command show only running container.

 # podman ps  

with ps -a option show all stopped and exited container.

 # podman ps -a  

8. Stopping the container

You can stop the running container gracefully through the podman stop command. Below is the basic syntax to stop the container and you can stop all containers at the same time with the -a option with the podman stop command.

Below command will stop the specific container , which we provided id or name of container.

 # podman stop container_id/container_name  

with -a option stop all container .

 # podman stop -a  

9. Remove the container

rm subcommand with podman to remove a container and discards its status and file system and if you want to remove or delete all containers then you can use -a option to delete all containers but all the containers should be in a stopped condition.

 # podman rm container_id/container_name  
 # podman rm -a 

10. Removing the container image

if you want to delete an image or all images from local storage, we can use rmi subcommand to remove images and to remove all images with the -a option.

 # podman rmi container_id/container_name  
 # podman rmi -a 

By Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks! Sachin G Follow me on LinkedIn and x formerly twitter