This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.2. Accessing registry directly from the cluster
You can access the registry from inside the cluster.
Procedure
Access the registry from the cluster by using internal routes:
Access the node by getting the node’s address:
oc get nodes
$ oc get nodes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc debug nodes/<node_address>
$ oc debug nodes/<node_address>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To enable access to tools such as
oc
andpodman
on the node, run the following command:chroot /host
sh-4.2# chroot /host
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Log in to the container image registry by using your access token:
oc login -u kubeadmin -p <password_from_install_log> https://api-int.<cluster_name>.<base_domain>:6443
sh-4.2# oc login -u kubeadmin -p <password_from_install_log> https://api-int.<cluster_name>.<base_domain>:6443
Copy to Clipboard Copied! Toggle word wrap Toggle overflow podman login -u kubeadmin -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
sh-4.2# podman login -u kubeadmin -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You should see a message confirming login, such as:
Login Succeeded!
Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意You can pass any value for the user name; the token contains all necessary information. Passing a user name that contains colons will result in a login failure.
Since the Image Registry Operator creates the route, it will likely be similar to
default-route-openshift-image-registry.<cluster_name>
.Perform
podman pull
andpodman push
operations against your registry:重要You can pull arbitrary images, but if you have the system:registry role added, you can only push images to the registry in your project.
In the following examples, use:
Expand Component Value <registry_ip>
172.30.124.220
<port>
5000
<project>
openshift
<image>
image
<tag>
omitted (defaults to
latest
)Pull an arbitrary image:
podman pull name.io/image
$ podman pull name.io/image
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Tag the new image with the form
<registry_ip>:<port>/<project>/<image>
. The project name must appear in this pull specification for OpenShift Container Platform to correctly place and later access the image in the registry:podman tag name.io/image image-registry.openshift-image-registry.svc:5000/openshift/image
$ podman tag name.io/image image-registry.openshift-image-registry.svc:5000/openshift/image
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意You must have the
system:image-builder
role for the specified project, which allows the user to write or push an image. Otherwise, thepodman push
in the next step will fail. To test, you can create a new project to push the image.Push the newly tagged image to your registry:
podman push image-registry.openshift-image-registry.svc:5000/openshift/image
$ podman push image-registry.openshift-image-registry.svc:5000/openshift/image
Copy to Clipboard Copied! Toggle word wrap Toggle overflow