Bootstrap FreeKB - OpenShift - List repositories in the internal registry
OpenShift - List repositories in the internal registry

Updated:   |  OpenShift articles

The first time you deploy an application, the application should be pulled down from the online repository that contains the image, such as the registry.redhat.io online repository or the hub.docker.com online repository, and stored in your internal OpenShift registry, such as image-registry.openshift-image-registry.svc:5000. In the openshift-image-registry namespace, there should be an image-registry deployment that contains an environment variable REGISTRY_OPENSHIFT_SERVER_ADDR which will have the registry URL.

~]$ oc get deployment image-registry --namespace openshift-image-registry --output yaml
spec:
  template:
    spec:
      containers:
        env:
        - name: REGISTRY_OPENSHIFT_SERVER_ADDR
          value: image-registry.openshift-image-registry.svc:5000

 

The curl command can be used to list the repositories in your internal registry.

curl -u username:password https://image-registry.openshift-image-registry.svc:5000/v2/_catalog

 

This will return output that looks something like this.

{"repositories":["foo/bar1","foo/bar2","foo/bar3"]}

 

If you have a large number of images in your internal registry, the ?n=10 option can be used to only list the first 10 images in the registry.

curl -u username:password https://image-registry.openshift-image-registry.svc:5000/v2/_catalog?n=10

 

Likewise, sed can be used to replace commas with newlines, making it much easier to make sense of the output.

curl -u username:password https://image-registry.openshift-image-registry.svc:5000/v2/_catalog | sed 's|,|\n|g'

 

Which should produce output like this.

{"repositories":["foo/bar1"
"foo/bar2"
"foo/bar3"]}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter db9def in the box below so that we can be sure you are a human.