In this exercise, you will use podman to retrieve, manage, and delete container images on your server.
Outcomes
You should be able to find, retrieve, inspect, and remove container images obtained from a remote container registry and stored on your server.
On the workstation machine, run the lab containers-managing start command.
This command runs a start script to determine whether the servera machine is reachable on the network.
It also checks and configures the container registry and ensures that the container image used for this exercise is stored there.
[student@workstation ~]$lab containers-managing start
Procedure 13.2. Instructions
Use the ssh command to log in to servera as the student user.
The systems are configured to use SSH keys for authentication, so a password is not required.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
Display the container registry configuration file and view configured registries.
[student@servera ~]$cat /home/student/.config/containers/registries.confunqualified-search-registries = ['registry.lab.example.com'] [[registry]] location = "registry.lab.example.com" insecure = true blocked = false
Search the registry for images with a name that starts with "ubi" using the podman search command.
[student@servera ~]$podman search registry.lab.example.com/ubiINDEX NAME DESCRIPTION STARS OFFICIAL example.com registry.lab.example.com/ubi7/ubi 0 example.com registry.lab.example.com/ubi8/ubi 0
Log in to the container registry using the podman login command.
[student@servera ~]$podman login registry.lab.example.comUsername:adminPassword:redhat321Login Succeeded!
Use the skopeo inspect command to view information on an image in the registry before downloading it.
The following skopeo inspect command is very long and should be entered as a single line.
[student@servera ~]$skopeo inspect docker://registry.lab.example.com/rhel8/httpd-24...output omitted... "Config": { "User": "1001", "ExposedPorts": { "8080/tcp": {}, "8443/tcp": {} }, "Env": [ "PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "container=oci", "SUMMARY=Platform for running Apache httpd 2.4 or building httpd-based application", "DESCRIPTION=Apache httpd 2.4 available as container, is a powerful, efficient, and extensible web server. Apache supports a variety of features, many implemented as compiled modules which extend the core functionality. These can range from server-side programming language support to authentication schemes. Virtual hosting allows one Apache installation to serve many different Web sites.", "STI_SCRIPTS_URL=image:///usr/libexec/s2i", "STI_SCRIPTS_PATH=/usr/libexec/s2i", "APP_ROOT=/opt/app-root", "HOME=/opt/app-root/src", "PLATFORM=el8", "HTTPD_VERSION=2.4", "HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/", "HTTPD_APP_ROOT=/opt/app-root", "HTTPD_CONFIGURATION_PATH=/opt/app-root/etc/httpd.d", "HTTPD_MAIN_CONF_PATH=/etc/httpd/conf", "HTTPD_MAIN_CONF_MODULES_D_PATH=/etc/httpd/conf.modules.d", "HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d", "HTTPD_TLS_CERT_PATH=/etc/httpd/tls", "HTTPD_VAR_RUN=/var/run/httpd", "HTTPD_DATA_PATH=/var/www", "HTTPD_DATA_ORIG_PATH=/var/www", "HTTPD_LOG_PATH=/var/log/httpd" ], "Entrypoint": [ "container-entrypoint" ], "Cmd": [ "/usr/bin/run-httpd" ], "WorkingDir": "/opt/app-root/src", ...output omitted...
Pull a container image from the registry using the podman pull command.
[student@servera ~]$podman pull registry.lab.example.com/rhel8/httpd-24Trying to pull registry.lab.example.com/rhel8/httpd-24... Getting image source signatures Copying blob 77c58f19bd6e done Copying blob 47db82df7f3f done Copying blob 9d20433efa0c done Copying blob 71391dc11a78 done Copying config 7e93f25a94 done Writing manifest to image destination Storing signatures 7e93f25a946892c9c175b74a0915c96469e3b4845a6da9f214fd3ec19c3d7070
Use the podman images command to view locally stored images.
[student@servera ~]$podman imagesREPOSITORY TAG IMAGE ID CREATED SIZE registry.lab.example.com/rhel8/httpd-24 latest 7e93f25a9468 4 weeks ago 430 MB
Use the podman inspect command to view information about a locally stored image.
[student@servera ~]$podman inspect registry.lab.example.com/rhel8/httpd-24...output omitted... "Config": { "User": "1001", "ExposedPorts": { "8080/tcp": {}, "8443/tcp": {} }, "Env": [ "PATH=/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "container=oci", "SUMMARY=Platform for running Apache httpd 2.4 or building httpd-based application", "DESCRIPTION=Apache httpd 2.4 available as container, is a powerful, efficient, and extensible web server. Apache supports a variety of features, many implemented as compiled modules which extend the core functionality. These can range from server-side programming language support to authentication schemes. Virtual hosting allows one Apache installation to serve many different Web sites.", "STI_SCRIPTS_URL=image:///usr/libexec/s2i", "STI_SCRIPTS_PATH=/usr/libexec/s2i", "APP_ROOT=/opt/app-root", "HOME=/opt/app-root/src", "PLATFORM=el8", "HTTPD_VERSION=2.4", "HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/", "HTTPD_APP_ROOT=/opt/app-root", "HTTPD_CONFIGURATION_PATH=/opt/app-root/etc/httpd.d", "HTTPD_MAIN_CONF_PATH=/etc/httpd/conf", "HTTPD_MAIN_CONF_MODULES_D_PATH=/etc/httpd/conf.modules.d", "HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d", "HTTPD_TLS_CERT_PATH=/etc/httpd/tls", "HTTPD_VAR_RUN=/var/run/httpd", "HTTPD_DATA_PATH=/var/www", "HTTPD_DATA_ORIG_PATH=/var/www", "HTTPD_LOG_PATH=/var/log/httpd" ], "Entrypoint": [ "container-entrypoint" ], "Cmd": [ "/usr/bin/run-httpd" ], "WorkingDir": "/opt/app-root/src", ...output omitted...
Remove a locally stored image using the podman rmi command.
[student@servera ~]$podman rmi registry.lab.example.com/rhel8/httpd-24Untagged: registry.lab.example.com/rhel8/httpd-24:latest Deleted: 7e93...7070
Run the podman images command to verify that the locally stored image is removed.
[student@servera ~]$podman imagesREPOSITORY TAG IMAGE ID CREATED SIZE
Exit from servera.
[student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$
This concludes the guided exercise.