Docker Community Forums

Share and learn in the Docker community.

No result from

Not able to fetch digetID from URL{RepositoryName}/{DockerImageName}/tags/{Version}
Getting below message {“errinfo”:null,“message”:“object not found”}

Earlier I used to fetch digest id and image related information to validate docker image. But now we are not getting result from{RepositoryName}/{DockerImageName}/tags/{Version} to validate docker image.

This URL is working for Open source Repository i.e. mongo
but not working for private repository.

The API endpoint doesn’t use the normal session so you have to authenticate yourself using a token. You can use this script:

#!/usr/bin/env bash

echo -n "Username: "
read -r username

echo -n "Password: "
read -rs password

echo -n "Repository: "
read -r repository

auth_request="$(echo '{}' | jq --arg username $username --arg password $password '{"username": $username, "password": $password}')"

token=$(curl -s -H "Content-Type: application/json" -X POST -d "$auth_request" | jq -r .token)

curl -s -H "Authorization: JWT $token" "$repository/tags/latest"

It will ask for username, password and the name of the repository.

Note: It requires “jq”

I have read this DockerHub Docker Registry API Examples
to create my version of the script.

You could also use hub-tool but it does not support setting the version tag:

hub-tool tag ls your/repository_without_tag --format json