How can I list all tags for a Docker image on a remote registry?

前端 未结 19 1957
时光取名叫无心
时光取名叫无心 2020-12-04 04:46

How can I list all tags of a Docker image on a remote Docker registry using the CLI (preferred) or curl?

Preferably without pulling all versions from the remote regi

19条回答
  •  無奈伤痛
    2020-12-04 05:11

    You can list all the tags with skopeo and jq for json parsing through cli.

    skopeo --override-os linux inspect docker://httpd | jq '.RepoTags'
    
    [
      "2-alpine",
      "2.2-alpine",
      "2.2.29",
      "2.2.31-alpine",
      "2.2.31",
      "2.2.32-alpine",
      "2.2.32",
      "2.2.34-alpine",
      "2.2.34",
      "2.2",
      "2.4-alpine",
      "2.4.10",
      "2.4.12",
      "2.4.16",
      "2.4.17",
      "2.4.18",
      "2.4.20",
      "2.4.23-alpine",
      "2.4.23",
      "2.4.25-alpine",
      "2.4.25",
      "2.4.27-alpine",
      "2.4.27",
      "2.4.28-alpine",
      "2.4.28",
      "2.4.29-alpine",
      "2.4.29",
      "2.4.32-alpine",
      "2.4.32",
      "2.4.33-alpine",
      "2.4.33",
      "2.4.34-alpine",
      "2.4.34",
      "2.4.35-alpine",
      "2.4.35",
      "2.4.37-alpine",
      "2.4.37",
      "2.4.38-alpine",
      "2.4.38",
      "2.4.39-alpine",
      "2.4.39",
      "2.4.41-alpine",
      "2.4.41",
      "2.4.43-alpine",
      "2.4.43",
      "2.4",
      "2",
      "alpine",
      "latest"
    ]
    

    For external registries:

    skopeo --override-os linux inspect --creds username:password docker://// | jq '.RepoTags'
    

    Note: --override-os linux is only needed if you are not running on a linux host. For example, you'll have better results with it if you are on MacOS.

提交回复
热议问题