Containers

Podman CLI

Podman commands for rootless container management.

37 commands
Windows MacOS Linux
#container-runtime #rootless

Container Management

Run a container in detached mode
podman run -d --name web nginx
Run an interactive container and remove on exit
podman run -it --rm alpine sh
List running containers
podman ps
List all containers including stopped
podman ps -a
Stop a running container
podman stop web
Start a stopped container
podman start web
Remove a stopped container
podman rm web
Follow container logs in real time
podman logs -f web

Image Management

Pull an image from a registry
podman pull docker.io/library/nginx
List all local images
podman images
Build an image from a Containerfile
podman build -t myapp .
Tag an image with a new name
podman tag myapp localhost/myapp:v1
Remove a local image
podman rmi nginx
Push an image to a registry
podman push myapp docker.io/user/myapp
Remove unused dangling images
podman image prune

Pod Management

Create a pod with port mapping
podman pod create --name mypod -p 8080:80
List all pods
podman pod list
Run a container inside a pod
podman run -d --pod mypod nginx
Stop all containers in a pod
podman pod stop mypod
Remove a pod and its containers
podman pod rm mypod
Generate Kubernetes YAML from a pod
podman generate kube mypod > pod.yaml
Create pods from Kubernetes YAML
podman play kube pod.yaml

Networking

Create a custom network
podman network create mynet
List all networks
podman network ls
Run a container on a custom network
podman run -d --network mynet --name app nginx
Show network configuration details
podman network inspect mynet
Remove a custom network
podman network rm mynet
Map host port 8080 to container port 80
podman run -d -p 8080:80 nginx

Volume Management

Create a named volume
podman volume create mydata
List all volumes
podman volume ls
Mount a named volume in a container
podman run -d -v mydata:/data nginx
Show volume details and mount point
podman volume inspect mydata
Remove a named volume
podman volume rm mydata
Remove all unused volumes
podman volume prune

Quick Commands

Run an nginx container in the background
podman run -d --name web nginx
Create a pod with port forwarding
podman pod create --name mypod -p 8080:80
Export a pod as Kubernetes YAML
podman generate kube mypod > pod.yaml