How Can I List All Tags for a Docker Image on a Remote Registry?

When working with Docker, it’s common to pull images from public or private registries. But sometimes, you may want to list all available tags for a given image to see which versions are available or to choose a specific tag to use.

Unfortunately, the Docker CLI doesn’t offer a built-in command like docker image list-tags. But don’t worry—there are several reliable ways to get this information.

In this blog, we’ll walk through how to list all tags for a Docker image from remote registries like Docker Hub, using both manual and scripted methods.


🔍 Method 1: Use Docker Hub API (Public Images)

If the image is hosted on Docker Hub, you can use their v2 REST API to fetch all tags.

💡 Example (for nginx image):

curl -s "https://registry.hub.docker.com/v2/repositories/library/nginx/tags?page_size=100" | jq '.results[].name'

This command:

  • Uses curl to hit the Docker Hub API
  • Fetches the first 100 tags
  • Uses jq to extract tag names

🧠 Notes:

  • library/nginx is used for official images.
  • Use pagination to get more than 100 results (?page=2, ?page=3, etc.)

🔁 Script to List All Tags (with Pagination)

#!/bin/bash
IMAGE="nginx"
PAGE=1

while :
do
  RESULT=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/$IMAGE/tags?page=$PAGE&page_size=100")
  TAGS=$(echo "$RESULT" | jq -r '.results[].name')
  
  if [[ -z "$TAGS" ]]; then
    break
  fi

  echo "$TAGS"
  ((PAGE++))
done

✅ This script will list all tags for the nginx image, page by page.


🔐 Method 2: Private Docker Registry (v2)

If you’re working with your own private Docker registry (that supports the Docker Registry HTTP API v2), you can use:

curl -s https://<your-registry>/v2/<image-name>/tags/list

Example:

curl -s https://myregistry.example.com/v2/myapp/tags/list | jq

✅ This returns a JSON object with all tag names.

🔒 For private registries with authentication, you may need to include -u username:password or a token header.


🧪 Method 3: Use Third-Party Tools

If you prefer a ready-made tool:

🛠️ skopeo

skopeo list-tags docker://docker.io/library/nginx
  • Works with multiple registries (Docker Hub, Quay, ECR, etc.)
  • Requires installation (brew install skopeo or apt install skopeo)

🧠 Summary

MethodBest ForRequires
Docker Hub APIPublic imagescurl, optionally jq
Private Registry APIInternal registriesAccess URL, permissions
Skopeo CLIAdvanced usersInstallation of tool

✅ Conclusion

Although Docker doesn’t offer a built-in command to list image tags, it’s easy to retrieve them using the Docker Registry API, shell scripts, or tools like Skopeo.

Whether you’re selecting the right tag for production or just exploring available versions, knowing how to list Docker image tags gives you better control over your container workflows.

Sharing Is Caring:

Leave a Comment