Podman Basics
Podman Basics
Podman
Podman basics
podman images podman run --rm -it [--name name] image:tag command
List all local images Run a container based on a given image.
podman history image:tag
--rm Remove the container after it exits
Display information about how an image was built
-it Connect the container to the terminal
podman login registryURL -u username [-p password]
--name name Give the container a name
Log in to a remote registry
image:tag The image used to create the container
podman pull registry/username/image:tag
A command to run (/bin/bash for
command
Pull an image from a remote registry example)
podman search searchString
Other options
Search local cache and remote registries for images
-d
Run the container in the background
The list of registries is de ned in
Note -p 8080:32000
/etc/containers/registries.conf
Expose container port 8080 as localhost:32000
podman logout
-v /var/lib/mydb:/var/lib/db
Log out of the current remote registry
Map the /var/lib/mydb directory on localhost to a volume named
/var/lib/db inside the container
BUILDING IMAGES
podman commit container newImage:tag
podman build -t image:tag . Create a new image based on the current state of a running
Build and tag an image using the instructions in Docker le in the container
current directory (don’t forget the dot!) podman create [--name name] image:tag
podman build -t image:tag -f Dockerfile2 Create (but don’t start) a container from an image
Same as above, but with a di erent Docker le podman start container
podman tag image:tag image:tag2 Start an existing container from an image
Add an additional name to a local image podman restart container
podman tag image:tag registry/username/image:tag Restart an existing container
Same as above, but the additional name includes a remote registry podman wait container1 [container2…]
podman push registry/username/image:tag Wait on one or more containers to stop
Push an image to a remote registry 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
WORKING WITH CONTAINER PROCESSES AND RESOURCES REMOVING IMAGES