Interact with container images in multiple container registries.
Outcomes
You should be able to:
Log in to container image registries.
Move container images between registries.
Test Quay images.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
[student@workstation ~]$ lab start images-basics
Instructions
In this exercise, your team must ensure that the internal Dev and Test pipelines use the same Python container image as the one that is in Red Hat OpenShift Container Platform (RHOCP).
To do so, copy the Python image from the RHOCP registry to the internal registry:
Source: default-route-openshift-image-registry.apps.ocp4.example.com/default/python:3.9-ubi8
Destination: registry.ocp4.example.com:8443/developer/python:3.9-ubi8
Log in to the container image registries.
Log in to RHOCP as the admin user.
[student@workstation ~]$ oc login -u admin -p redhatocp \
https://api.ocp4.example.com:6443
Login successful.
...output omitted...RHOCP and the oc command are explored later in the course.
Log in to the RHOCP registry with Podman.
[student@workstation ~]$ podman login -u $(oc whoami) -p $(oc whoami -t) \
default-route-openshift-image-registry.apps.ocp4.example.com
Login Succeeded!Log in to the registry.ocp4.example.com:8443 registry with Podman.
[student@workstation ~]$ podman login -u developer -p developer \
registry.ocp4.example.com:8443
Login Succeeded!Use skopeo to copy the default-route-openshift-image-registry.apps.ocp4.example.com/default/python:3.9-ubi8 image to the registry.ocp4.example.com:8443 registry.
[student@workstation ~]$\ RHOCP_REGISTRY="default-route-openshift-image-registry.apps.ocp4.example.com"[student@workstation ~]$skopeo copy --dest-tls-verify=false \ docker://${RHOCP_REGISTRY}/default/python:3.9-ubi8 \ docker://registry.ocp4.example.com:8443/developer/python:3.9-ubi8Getting image source signatures ...output omitted...
Make the image public in the internal registry.
In a web browser, navigate to https://registry.ocp4.example.com:8443 and log in with the user developer and password developer.
Type developer in the field, then click the repository.
Click the icon at the bottom of the page. Scroll to the settings and click . Then, click .
Test the image as an unauthenticated user.
In a terminal, log out from all container image registeries.
[student@workstation ~]$ podman logout --all
Removed login credentials for all registriesPull the registry.ocp4.example.com:8443/developer/python:3.9-ubi8 image.
[student@workstation ~]$ podman pull \
registry.ocp4.example.com:8443/developer/python:3.9-ubi8
Trying to pull registry.ocp4.example.com:8443/developer/python:3.9-ubi8...
...output omitted...
e972...ac821Start a container that uses the image.
[student@workstation ~]$ podman run --rm \
registry.ocp4.example.com:8443/developer/python:3.9-ubi8 python3 --version
Python 3.9.13