Podman Flashcards
Search for images containing button
podman search button
Download images containing button
podman pull button
List local images
podman images
Run container ubi8/ubi:8.3 such that it prints ‘Hello word’
podman run ubi8/ubi:8.3 echo ‘Hello world!’
Explain the -d option
Run container image as a background process
Run bash on container ubi8/ubi:8.3
podman run -it ubi8/ubi:8.3 /bin/bash
Run MySQL with image: registry.redhat.io/rhel8/mysql-80
podman run –name mysql-custom \
> -e MYSQL_USER=redhat -e MYSQL_PASSWORD=r3dh4t \
> -e MYSQL_ROOT_PASSWORD=r3dh4t \
> -d registry.redhat.io/rhel8/mysql-80
Run container to set environment variable GREET and print it
podman run -e GREET=Hello -e NAME=RedHat \
> ubi8/ubi:8.3 printenv GREET NAME
Run bash on a running container
podman exec -it mysql-basic /bin/bash
Displays all actively running containers
podman ps
Displays all running and stopped containers
podman ps -a
Stop container my-httpd-container
podman stop my-httpd-container
Kill container
podman kill my-httpd-container
Restart container
podman restart my-httpd-container
Remove container
podman rm my-httpd-container
Restart container
podman restart my-httpd-container
Delete all containers
podman rm -a
Stop all containers
podman stop -a
Login to container registry
podman login registry.redhat.io
View container logs
podman logs mysql-db
Copy database file to mysql container.
podman cp ~/db.sql mysql:/
Execute sql query inplace in mysql container
podman exec mysql /bin/bash -c ‘mysql -uuser1 -pmypa55 -e “select * from items.Projects;”’
Explain podman unshare
provides a session to execute commands within the same user namespace as the process running inside the container
Example unshare command
podman unshare chown -R 27:27 /home/student/dbfiles
mount a host directory to a container,
podman run -v /home/student/dbfiles:/var/lib/mysql rhmap47/mysql
List a container’s ports
podman port apache3
Where do to you configure registries use by podman?
/etc/containers/registries.conf
What is the format of image files when stored locally?
.tar
Syntax of the save command
podman save [-o FILE_NAME] IMAGE_NAME[:TAG]
How do you use container stored locally?
podman load -i mysql.tar
Delete image from local storage
podman rmi [OPTIONS] IMAGE [IMAGE…]
Delete all images that are not used by any container
podman rmi -a
Save container from registry
podman save -o mysql.tar registry.redhat.io/rhel8/mysql-80
Turn running container into new image
podman commit mysql-basic mysql-custom
Tag an image as latest
podman tag 0e3bbc2 fedora:latest
podman tag httpd myregistryhost:5000/fedora/httpd:v2
Tag a new image as snapshot
podman tag mysql-custom devops/mysql:snapshot
Untag an image
podman rmi devops/mysql:snapshot