howtouselinux

Podman Command Cheat Sheet on Linux

Table of Contents

Podman is a Linux native tool designed to find, run, build, share and deploy applications using Open Containers Initiative ( OCI) Containers and Container Images. We collect this basic podman cheat sheet to help you learn it efficiently.

podman run –rm -it [–name name] image:tag command

  • Run a container based on a given image.
  • –rm Remove the container after it exits
  • -it Connects the container to the terminal
  • –name name Connect the container to the terminal
  • image:tag The image used to create the container
  • command A command to run (/bin/bash for example)
  • -d Run the container in the background
  • -p 8080:32000 Expose container port 8080 as localhost:32000
  • -v /var/lib/mydb:/var/lib/db Map the /var/lib/mydb directory on localhost to a volume named /var/lib/db inside the container

podman commit container newImage:tag

Create a new image based on the current state of a running container

podman create [–name name] image:tag

Create (but don’t start) a container from an image

podman start container

Start an existing container from an image

podman restart container

Restart an existing container

podman wait container1 [container2…]

Wait on one or more containers to stop

podman stop container

Stop a running container gracefully

podman kill container

Send a signal to a running container

podman rm [-f] container

Remove a container (use -f if the container is running)

podman stats container

Display a live stream of a container’s resource usage

podman inspect container

Return metadata (in JSON) about a running container

David Cao
David Cao

Hey there! I am David, a Cloud & DevOps Enthusiast and 18 years of experience as a Linux engineer. I work with AWS, Git & GitHub, Linux, Python, Ansible, and Bash. I am a technical blogger and a Software Engineer, enjoy sharing my learning and contributing to open-source.