Skip to content

list tags for docker image #29

Description

@davideuler

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
 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions