recentpopularlog in

kme : containers   11

How to list all tags of a docker image
This is one way to do this, and it works. See also this Gist, which 'docker pulls' a bunch of Bash images to see if that version of Bash has a certain 'shopt' option: https://gist.github.com/ernstki/b782cc7f2a29ec01c1f4355f2dd312cc.
<code class="language-bash">
image=debian
for (( i=0; $?==0; i++ )); do
i=$((i+1))
curl -sL https://registry.hub.docker.com/v2/repositories/library/$image/tags/?page=$i 2>/dev/null \
| jq -r '.results[]["name"]'
done</code>
You can also get the total number of tags from the "count" attribute of the first JSON response, which also gives you the "next" URL.

Possibly see also: https://docs.docker.com/v17.09/registry/spec/api/, but I don't know what the difference between Docker Hub, Docker Registry, and a Docker "Trusted" Registry is, or which one exactly the public Docker Hub is.
docker  cli  commandline  containers  automation  sysadmin  solution 
august 2019 by kme

Copy this bookmark:





to read