All Commands:
Chapter 2:
podman -v ( to know podman version)
podman login <registry-name> (to login in a registry)
podman pull <image_name> (to pull an image)
podman images (to list all images)
podman ps (to list running containers)
podman ps –all (-a) (to list all containers)
podman run <image_name> (to create a new container that uses the
image)
podman network create (to create a network)
podman network ls (to list all network)
podman network inspect <network_name> (to get a detailed JSON
object containing configuration data for the network)
podman network rm <network_name> (to remove a newtwork)
podman network prune (Removes any networks that are not
currently in use by any running containers)
podman network connect <network_name> <container_name>
(Connects an already running container to or from an existing
network)
podman network disconnect <network_name> <container_name>
(Disconnects an already running container to or from an existing
network)
podman port <container_name> (to mapping port of container)
podman stop <container_name> or <container_ID> (to stop a
running container)
podman kill <container_name> or <container_ID> (to stop a
running container by force)
podman pause <container_name> or <container_ID> (to pause a
container)
podman unpause <container_name> or <container_ID> (to
unpause a container)
podman restart <container_name> or <container_ID> (to restart a
container)
Chapter 3:
skopeo copy <image_name> <dir> ( to copy images between registries )
skopeo inspect <image_name> ( to inspect image metadata )
podman image tag LOCAL_IMAGE:TAG LOCAL_IMAGE:NEW_TAG (To create
additional tags for local images)
podman search ( to search for images in all the registries)
podman build --file Containerfile –tag
quay.io/YOUR_QUAY_USER/IMAGE_NAME:TAG (to create an image)
podman push quay.io/YOUR_QUAY_USER/IMAGE_NAME:TAG ( to push an
image)
podman image rm -f <image-path> (to remove an image)
podman rmi –all or podman image rm –all (to remove all images in local
storage)
podman image prune (to delete all images without tags)
podman image prune -a (to delete both images without tags and unused)
Chapter 4:
podman image tree <image_name> (to show number of images layers)
podman volume create <VOLUME_NAME> (to create a volume)
podman volume prune (to remove unused volumes)
podman volume ls (to list all volumes)
podman build --squash -t localhost/squashed (to squash layers declared in
the Containerfile)
podman build --squash-all -t localhost/squashed-all (reduces the image size
by combining all layers of parents images)
Chapter 5:
podman unshare <command> (executes provided Linux commands in a
new namespace)
podman network inspect <volume_name> (to get a detailed JSON
object containing configuration data for the volume)
podman volume import <volume-name> <archive-name> (to import
data into container)
podman volume export <volume-name> --output <archive-name> (to
export data into container)
Chapter 6:
podman logs <CONTAINER-NAME> (to access output error information
when a container is exited)
podman exec -it <CONTAINER-NAME> ss -pant (to list the open sockets
using options -p: display the process using the socket, -a: display listening
and established connections, -n: display numeric ports instead of mapped
service names , -t: display TCP sockets)
sudo nsenter -n -t CONTAINER_PID ss -pant (to target a container
namespace)
ls -Z <file-name> (to get the SELinux context for the file)