If you’re running your own private Docker Registry v2, you may want to query it and list all available repositories and image tags. While Docker Hub provides a web UI and API, a private registry often requires direct API calls.
This guide shows how to fetch a list of images and tags from a Docker Registry v2.
1️⃣ Docker Registry HTTP API v2
The Registry API v2 exposes REST endpoints to interact with repositories, images, and tags.
The most useful ones:
- List all repositories
GET /v2/_catalog - List tags for a repository
GET /v2/<repository_name>/tags/list
2️⃣ Example: List All Repositories
If your registry is running at https://myregistry.example.com, use:
curl https://myregistry.example.com/v2/_catalog
Example response:
{
"repositories": [
"app-backend",
"app-frontend",
"database"
]
}
This lists all repositories stored in your registry.
3️⃣ Example: List Tags for a Repository
To list all tags of a repository (e.g., app-backend):
curl https://myregistry.example.com/v2/app-backend/tags/list
Example response:
{
"name": "app-backend",
"tags": [
"latest",
"v1.0.0",
"v1.1.0"
]
}
4️⃣ Authentication (If Enabled)
If your registry requires authentication, log in first:
docker login myregistry.example.com
Or pass credentials directly in curl:
curl -u username:password https://myregistry.example.com/v2/_catalog
5️⃣ Pagination
For large registries, the /v2/_catalog API may return paginated results. Use the n parameter to limit results per page:
curl "https://myregistry.example.com/v2/_catalog?n=100"
If more results exist, the response includes a Link header with the next page.
📌 Summary
- Use
GET /v2/_catalog→ lists all repositories - Use
GET /v2/<repository>/tags/list→ lists all tags for a repository - Supports authentication (
docker login) and pagination (nparameter)
With these API calls, you can programmatically explore and manage images stored in a private Docker Registry v2.