An essential part of managing containers is working with container images. In this lab, we install and configure a Podman environment and use Podman and Skopeo to manage container images in our environment. Upon completion, you can install and configure a Podman environment and use it to manage container images.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Install Podman Using yum or Application Streams
- Install
podman
on your RHEL server usingyum
. Alternatively, you can use Application Streams to install thecontainer-tools
package stream.Note: If you use Application Streams, make sure you use the default stream.
2.We need to add
'localhost'
to the empty line for[registries.insecure]
in the/etc/containers/registries.conf
file to specify our local container registry as an insecure registry. You’ll need to do this usingsudo
.- Install
- Start the Local Container Image Registry
- A local container image registry has been pre-configured on your server. Before we can use it, we need to start it.
- Run the script (
registry.sh
), provided in thecloud_user
home directory. Run this script withsudo
, as it requiresroot
privilages.
- Manage Container Images Using Podman
The
podman
command comes with quite a bit of container management functionality included. Let’s try the following:- Check your installed version of
podman
- Check out the help information on the
podman
command - Check out the help information on the
podman image
command - Use
podman
to search for theubi:latest
container images - Use
podman
to pull a copy of theregistry.access.redhat.com/ubi8/ubi:latest
container image - Compare the
podman images
command to thepodman image list
command - Compare the
podman inspect ubi
command to thepodman image inspect ubi
command - Add the
myubi
tag to theubi:latest
image - List our container images again
- Log in to the local container inage registry at
localhost:5000
- Push the
ubi:latest
image in our local container image storage to the registry running on our lab server- Tag the
ubi:latest
image with the target oflocalhost:5000/ubi8/ubi
- Push the image to
localhost:5000/ubi8/ubi:latest
- Use the
--remove-signatures
switch
- Use the
- Tag the
- Check the local registry’s contents using
curl -u cloud_user https://localhost:5000/v2/_catalog
and thecloud_user
password - Remove the
myubi
tag - List our container images again
- Remove the image with no tags using the
imageID
- List our container images again
- Use
podman
to search our local registry - Using
podman
, log out of the local container registry
- Check your installed version of
- Manage Container Images Using Skopeo
Even though the
podman
command can be used to perform container image management, taking things to the next level requiresskopeo
. Let’s try the following withskopeo
:- Check your installed version of
skopeo
- Check out the help information on the
skopeo
command - Check out the help information on the
skopeo inspect
command - Use
skopeo
to log in to the local container image registry atlocalhost:5000
- Use
skopeo
to copy a container image directly fromdocker://registry.access.redhat.com/ubi7/ubi:latest
to our local registry (docker://localhost:5000/ubi7/ubi
) - Check the local registry’s contents using
curl -u cloud_user https://localhost:5000/v2/_catalog
and thecloud_user
password - Use
skopeo
to sync a container image fromdocker://registry.access.redhat.com/ubi7/ubi:latest
to our local registry (docker://localhost:5000/ubi7/ubi
) - Use
skopeo
to inspect theubi7
andubi8
images on the local container registry - Use
skopeo
to list the tags on theubi7
andubi8
images on the local container registry - Use
podman
to search our local registry (localhost:5000/ubi
) - Use
skopeo
to log out of the local container image registry atlocalhost:5000
- Check your installed version of