How to list internal registry repositories and images in OpenShift 4

Solution Verified - Updated

Environment

  • OpenShift Container Platform
    • 4.x

Issue

  • Registry console is no longer available in OpenShift 4, how can I list all the repositories and images from outside the cluster?

Resolution

  • Expose the public route for the internal registry (disabled by default):
$ oc patch configs.imageregistry.operator.openshift.io/cluster --patch '{"spec":{"defaultRoute":true}}' --type=merge
  • How to list all repositories (catalog):
$ TOKEN=$(oc whoami -t)
$ curl -k -H "Authorization: Bearer ${TOKEN}" "https://default-route-openshift-image-registry.apps.<clusterid>.<domain>/v2/_catalog" | jq .

Example:

$ curl -k -H "Authorization: Bearer ${TOKEN}" "https://default-route-openshift-image-registry.apps.pamoedo.example.com/v2/_catalog" | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2803  100  2803    0     0  10010      0 --:--:-- --:--:-- --:--:-- 10046
{
  "repositories": [
    "openshift/apicast-gateway",
    "openshift/apicurito-ui",
    "openshift/cli",
    "openshift/cli-artifacts",
    "openshift/dotnet",
    "openshift/dotnet-runtime",
    "openshift/eap-cd-openshift",
    "openshift/fis-java-openshift",
    "openshift/fis-karaf-openshift",
    "openshift/fuse-apicurito-generator",
    "openshift/fuse7-console",
    "openshift/fuse7-eap-openshift",
    "openshift/fuse7-java-openshift",
    "openshift/fuse7-karaf-openshift",
    "openshift/golang",
    "openshift/httpd",
    "openshift/installer",
    "openshift/installer-artifacts",
    "openshift/java",
    "openshift/jboss-amq-62",
    "openshift/jboss-amq-63",
    "openshift/jboss-datagrid65-client-openshift",
    "openshift/jboss-datagrid65-openshift",
    "openshift/jboss-datagrid71-client-openshift",
    "openshift/jboss-datagrid71-openshift",
    "openshift/jboss-datagrid72-openshift",
    "openshift/jboss-datagrid73-openshift",
    "openshift/jboss-datavirt64-driver-openshift",
    "openshift/jboss-datavirt64-openshift",
    "openshift/jboss-decisionserver64-openshift",
    "openshift/jboss-eap64-openshift",
    "openshift/jboss-eap70-openshift",
    "openshift/jboss-eap71-openshift",
    "openshift/jboss-eap72-openshift",
    "openshift/jboss-fuse70-console",
    "openshift/jboss-fuse70-eap-openshift",
    "openshift/jboss-fuse70-java-openshift",
    "openshift/jboss-fuse70-karaf-openshift",
    "openshift/jboss-processserver64-openshift",
    "openshift/jboss-webserver30-tomcat7-openshift",
    "openshift/jboss-webserver30-tomcat8-openshift",
    "openshift/jboss-webserver31-tomcat7-openshift",
    "openshift/jboss-webserver31-tomcat8-openshift",
    "openshift/jboss-webserver50-tomcat9-openshift",
    "openshift/jenkins",
    "openshift/jenkins-agent-maven",
    "openshift/jenkins-agent-nodejs",
    "openshift/mariadb",
    "openshift/modern-webapp",
    "openshift/mongodb",
    "openshift/must-gather",
    "openshift/mysql",
    "openshift/nginx",
    "openshift/nodejs",
    "openshift/oauth-proxy",
    "openshift/openjdk-11-rhel7",
    "openshift/openjdk-11-rhel8",
    "openshift/openjdk-8-rhel8",
    "openshift/perl",
    "openshift/php",
    "openshift/postgresql",
    "openshift/python",
    "openshift/redhat-openjdk18-openshift",
    "openshift/redhat-sso70-openshift",
    "openshift/redhat-sso71-openshift",
    "openshift/redhat-sso72-openshift",
    "openshift/redhat-sso73-openshift",
    "openshift/redis",
    "openshift/rhdm-decisioncentral-rhel8",
    "openshift/rhdm-kieserver-rhel8",
    "openshift/rhdm-optaweb-employee-rostering-rhel8",
    "openshift/rhdm74-decisioncentral-openshift",
    "openshift/rhdm74-kieserver-openshift",
    "openshift/rhdm74-optaweb-employee-rostering-openshift",
    "openshift/rhpam-businesscentral-monitoring-rhel8",
    "openshift/rhpam-businesscentral-rhel8",
    "openshift/rhpam-kieserver-rhel8",
    "openshift/rhpam-smartrouter-rhel8",
    "openshift/rhpam74-businesscentral-monitoring-openshift",
    "openshift/rhpam74-businesscentral-openshift",
    "openshift/rhpam74-kieserver-openshift",
    "openshift/rhpam74-smartrouter-openshift",
    "openshift/ruby",
    "openshift/tests",
  ]
}
  • How to list all tags from specific image:
$ TOKEN=$(oc whoami -t)
$ curl -k -H "Authorization: Bearer ${TOKEN}" "https://default-route-openshift-image-registry.apps.<clusterid>.<domain>/v2/<repository>/<image>/tags/list" | jq .

Example:

$ curl -k -H "Authorization: Bearer ${TOKEN}" "https://default-route-openshift-image-registry.apps.pamoedo.example.com/v2/openshift/mysql/tags/list" | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    57  100    57    0     0    272      0 --:--:-- --:--:-- --:--:--   272
{
  "name": "openshift/mysql",
  "tags": [
    "5.7",
    "8.0",
    "latest"
  ]
}

Root Cause

  • Registry console was deprecated and is no longer available in OpenShift 4.
SBR
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.