How to get the list of docker images from Azure private registry

You can use the container registry cli for azure:

az acr repository list --name <acrName> --output table

https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli


Not used to Azure I accidentally got stuck on the idea that I needed the Azure credentials to access the API, these answers strengthening that perception, but given you have the u/p you should be able to access it with curl in a simple:

curl -L --user <username>:<password> myregistry.azurecr.io/v2/_catalog 

{"repositories":["name1", "name2", "nameN"]}

It is important to understand how docker lists the images in the registry. Docker CLI provides command to pull/push/delete images from a private Azure Registry like myprivate.azurecr.io after the user authenticates itself using docker login command but the docker CLI does not provide any command to list the images in the private registry.

It is important to understand that the docker image ls only lists the images present on the local machine and not in a registry. There are multiple answers that describe the Docker HTTP API V2 (Refer here) to list the images present in the registry. The HTTP v2 API v2/_catalog and other only work with local registry created on-premise but when user wants to list the images present in the Private Azure Registry one needs to use Azure CLI

What is Local Registry ?

The Registry is a stateless, highly scalable server side application that stores and lets you distribute Docker images. The Registry is open-source, under the permissive Apache license. Local Registry can be created to store and distribute images in house or on-premise. Refer here : https://docs.docker.com/registry/ . One can create a private registry,push and pull image from there using Dokcker HTTP API V2.

Azure CR is a special type and inorder to list the images there is no other option to Azure CLI.

Use Case - List the top three images present in the registry The command for the same can be

az acr repository show-tags -n <RegistryName> --repository <RepositoryName> --orderby time_desc --output table | select -First 5

Tags:

Docker

Azure