Openshift is a very convenient platform, not only it provides an enterprise kubernetes cluster, but also provide its own image registry bundled within it. So we can push images and deploy it to our namescpace within our cluster in a timely manner. But there are times when i need to count how many images are resides in my existing Openshift cluster. After googling quite some time, i found the solution and write it here.
First we need to check where is our Openshift image registry url,
C:\>oc project default Already on project "default" on server "https://console.example.com:8443". C:\>oc get route NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD docker-registry docker-registry-default.apps.example.com docker-registry 5000-tcp reencrypt None registry-console registry-console-default.apps.example.com registry-console <all> passthrough None
Next step is login to our oc cluster by using this command, and insert the right username and password.
oc login https://console.example.com:8443
And see the oc login token
oc whoami -t
Use both username and token to do a simple curl to your docker registry url,
C:\>curl -X GET https://docker-registry-default.apps.example.com/v2/_catalog -k -u <my-username>:<my-token>
The result of that api contains list of images available on your Openshift’s Image Registry.