Open
Description
Put the following script to ~/.bashrc or ~/.zshrc for bash, zsh respectively.
Then you can run listTags gogs/gogs, or listTags ubuntu to list docker image tags from the docker repository.
function listTags() {
local repo=${1}
local size=${2:-25}
local page=${3:-1}
[ -z "${repo}" ] && echo "Usage: listTags <repoName> [size] [pageIndex]" 1>&2 && return 1
if [[ $repo == *"/"* ]]; then
curl "https://hub.docker.com/v2/repositories/${repo}/tags/?page=${page}&page_size=${size}" 2>/dev/null | jq -r '.results[].name' | sort
else
curl "https://registry.hub.docker.com/api/content/v1/repositories/public/library/${repo}/tags?page=${page}&page_size=${size}" 2>/dev/null | jq -r '.results[].name' | sort
fi
}
Metadata
Metadata
Assignees
Labels
No labels