Bookmark this page

Guided Exercise: Container Image Registries

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

  1. Log in to the container image registries.

    1. 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...

      Note

      RHOCP and the oc command are explored later in the course.

    2. 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!
    3. 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!
  2. 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-ubi8
    Getting image source signatures
    ...output omitted...
  3. Make the image public in the internal registry.

    1. In a web browser, navigate to https://registry.ocp4.example.com:8443 and log in with the user developer and password developer.

    2. Type developer in the Filter Repositories field, then click the developer/python repository.

    3. Click the Settings icon at the bottom of the page. Scroll to the Repository Visibility settings and click Make Public. Then, click OK.

  4. Test the image as an unauthenticated user.

    1. In a terminal, log out from all container image registeries.

      [student@workstation ~]$ podman logout --all
      Removed login credentials for all registries
    2. Pull 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...ac821
    3. Start 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

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish images-basics

Revision: do188-4.14-8c43a16