Skip to main content

Simple management tool for pods, containers and images. Podman provides a Docker-CLI comparable command line. Simply put: alias docker=podman.

##
# podman
##

# To list all containers (both running and stopped):
podman ps --all

# To create a container from an image, with a custom name:
podman run --name <container_name> <image>

# To start or stop an existing container:
podman <start|stop> <container_name>

# To pull an image from a registry (defaults to Docker Hub):
podman pull <image>

# To display the list of already downloaded images:
podman images

# To open a shell inside an already running container:
podman exec --interactive --tty <container_name> <sh>

# To remove a stopped container:
podman rm <container_name>

# To display the logs of one or more containers and follow log output:
podman logs --follow <container_name> <container_id>

##
# podman build
##

# To create an image using a 'Dockerfile' or 'Containerfile' in the specified directory:
podman build <path/to/directory>

# To create an image with a specified tag:
podman build --tag <image_name:version> <path/to/directory>

# To create an image from a non-standard file:
podman build --file <Containerfile.different> .

# To create an image without using any previously cached images:
podman build --no-cache <path/to/directory>

# To create an image suppressing all output:
podman build --quiet <path/to/directory>

##
# podman run
##

# To run command in a new container from a tagged image:
podman run <image:tag> <command>

# To run command in a new container in background and display its ID:
podman run --detach <image:tag> <command>

# To run command in a one-off container in interactive mode and pseudo-TTY:
podman run --rm --interactive --tty <image:tag> <command>

# To run command in a new container with passed environment variables:
podman run --env '<variable>=<value>' --env <variable> <image:tag> <command>

# To run command in a new container with bind mounted volumes:
podman run --volume </path/to/host_path>:</path/to/container_path> <image:tag> <command>

# To run command in a new container with published ports:
podman run --publish <host_port>:<container_port> <image:tag> <command>

# To run command in a new container overwriting the entrypoint of the image:
podman run --entrypoint <command> <image:tag>

# To run command in a new container connecting it to a network:
podman run --network <network> <image:tag>

##
# podman-compose
##

# To list all running containers:
podman-compose ps

# To create and start all containers in the background using a local 'docker-compose.yml':
podman-compose up -d

# To start all containers, building if needed:
podman-compose up --build

# To start all containers using an alternate compose file:
podman-compose <path/to/file> up

# To stop all running containers:
podman-compose stop

# To remove all containers, networks, and volumes:
podman-compose down --volumes

# To follow logs for a container (omit all container names):
podman-compose logs --follow <container_name>

# To run a one-time command in a service with no ports mapped:
podman-compose run <service_name> <command>

##
# podman image
##

# To list local Docker images:
podman image ls

# To delete unused local Docker images:
podman image prune

# To delete all unused images (not just those without a tag):
podman image prune --all

# To show the history of a local Docker image:
podman image history <image>

##
# podman images
##

# To list all Podman images:
podman images

# To list all Podman images including intermediates:
podman images --all

# To list the output in quiet mode (only numeric IDs):
podman images --quiet

# To list all Podman images not used by any container:
podman images --filter dangling=true

# To list images that contain a substring in their name:
podman images "<*image|image*>"

##
# podman machine
##

# To list existing machines:
podman machine ls

# To create a new default machine:
podman machine init

# To create a new machine with a specific name:
podman machine init <name>

# To create a new machine with different resources:
podman machine init --cpus=<4> --memory=<4096> --disk-size=<50>

# To start or stop a machine:
podman machine <start|stop> <name>

# To connect to a running machine via SSH:
podman machine ssh <name>

# To inspect information about a machine:
podman machine inspect <name>

##
# podman ps
##

# To list currently running podman containers:
podman ps

# To list all podman containers (running and stopped):
podman ps --all

# To show the latest created container (includes all states):
podman ps --latest

# To filter containers that contain a substring in their name:
podman ps --filter "name=<name>"

# To filter containers that share a given image as an ancestor:
podman ps --filter "ancestor=<image>:<tag>"

# To filter containers by exit status code:
podman ps --all --filter "exited=<code>"

# To filter containers by status (created, running, removing, paused, exited and dead):
podman ps --filter "status=<status>"

# To filter containers that mount a specific volume or have a volume mounted in a specific path:
podman ps --filter "volume=<path/to/directory>" --format "table <.ID>\t<.Image>\t<.Names>\t<.Mounts>"

##
# podman rmi
##

# To remove one or more images given their names:
podman rmi <image:tag> <image2:tag> <...>

# To force remove an image:
podman rmi --force <image>

# To remove an image without deleting untagged parents:
podman rmi --no-prune <image>

# To display help:
podman rmi