Answers: <p>I posted the <a href="https://stackoverflow.com/questions/52942359/how-to-pull-all-alternative-tags-of-a-docker-image">same question at stackoverflow</a>. The question is answered there and I have posted my script. For the sake of completeness, I will post it here as well.</p>
  
  <pre><code>#!/bin/sh
  
  TOKEN=`curl -s "https://auth.docker.io/token?service=registry.docker.io&amp;scope=repository:gitlab/gitlab-runner-helper:pull" | jq '.token' | sed 's/"//g'`
  TAGS=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/tags/list -H "Authorization: Bearer $TOKEN" | jq ".tags[]" | sed 's/"//g' | grep x86_64`
  
  for tag in $TAGS;
  do
    # is $tag an old entry?
    if grep -Fxq $tag tags.list
    then
      # already processed
      continue
    else
      echo "new tag found: $tag"
      newSHA=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/manifests/$tag -H "Authorization: Bearer $TOKEN" | jq ".fsLayers[] .blobSum" | sed 's/"//g'`
      latestSHA=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/manifests/x86_64-latest -H "Authorization: Bearer $TOKEN" | jq ".fsLayers[] .blobSum" | sed 's/"//g'`
      if [ "$newSHA" = "$latestSHA" ]
      then
        echo "$tag is new latest version"
        docker pull gitlab/gitlab-runner-helper:$tag
        echo $tag &gt;&gt; tags.list
      fi
    fi
  done
  </code></pre>
  
  <p>The above script utilizes a file named <code>tags.list</code>, that is placed next to it. This file contains the older tags, to prevent issuing 500+ HTTP requests. If a tag from the <code>TAGS</code> is not yet present in the file, it does not mean, it is the latest. Sometimes tags appear, that eventually will become the latest version. Those tags are probed, but will not be inserted into the file. This might become an issue in the future, if those versions will be skipped as latest.</p>
  
  <p><strong>Note:</strong> The script above only focuses on a specific subset of tags <code>(x86_64)</code>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-22T10:48:27.743Z
Answers: 2019-01-22T10:48:27.743Z
Answers: tgr
Answers: <p>You can list all alternative image using the <a href="https://github.com/genuinetools/reg" rel="nofollow noreferrer">reg</a> tool.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-24T06:51:18.303Z
Answers: I don't want alternative images. I am searching for alternative tags of a single image.
Answers: tgr
Answers: CC BY-SA 4.0
Answers: 2018-10-24T08:52:15.130Z
Answers: you can do it also. you can grep all tags by imagename
Answers: Meiram Chuzhenbayev
Answers: CC BY-SA 4.0
Answers: 2019-01-22T10:42:40.980Z
Answers: According to their documentation, the list of the tags does NOT include the image hash and is therefore not suitable for my usecase.
Answers: tgr
Answers: CC BY-SA 4.0
Answers: 2018-10-23T10:16:57.490Z
Answers: 2018-11-23T22:35:17.863Z
Answers: 2018-11-23T22:35:17.863Z
Answers: Meiram Chuzhenbayev
Body: <p>I administer a GitLab instance with a build pipeline. All components are encapsulated in Docker images from the official GitLab maintainer.</p>
  
  <p>Whenever I update - usually once a week - I need to check whether the <code>gitLab/gitlab-runner-helper</code> still works for the current latest version of GitLab. This can only be checked by executing a pipeline. If it does not work, the log tells me exactly what image it needs an I proceed to pull it.</p>
  
  <p>The image in question is also tagged with a latest tag, which I cannot use, due to the hard dependency to the non-volatile tag.</p>
  
  <pre><code>$docker image ls
  REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
  gitlab/gitlab-runner-helper   x86_64-8af42251     1ee5a99eba5f        20 hours ago        43.7MB
  gitlab/gitlab-runner-helper   x86_64-latest       1ee5a99eba5f        20 hours ago        43.7MB
  </code></pre>
  
  <p><strong>To automate my update process, I'd like to know, how I could pull the latest image with all alternative tags?</strong></p>
  
  <p>The man page of Docker pull says, there is a <code>--all-tags</code> option, to load any tagged image from the repository, but this cannot be combined with a tag.</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-10-23T09:13:02.010Z
Comments: Perhaps https://stackoverflow.com/questions/28320134/how-to-list-all-tags-for-a-docker-image-on-a-remote-registry has the answer you seek?
Comments: Bruce Becker
Comments: CC BY-SA 4.0
Comments: 2018-10-24T06:53:36.660Z
Comments: That is unfortunately not the the answer. I am searching for alternative tags of a single image.
Comments: tgr
Tags: <docker><gitlab><gitlab-ci-runner>
Title: How to pull all alternative tags of a Docker image?
UserDisplayName: tgr
ThreadText: # How to pull all alternative tags of a Docker image?
  
  (Asked by: username_0 on 2018-10-23)
  
  I administer a GitLab instance with a build pipeline. All components are encapsulated in Docker images from the official GitLab maintainer.
  
  Whenever I update - usually once a week - I need to check whether the `gitLab/gitlab-runner-helper` still works for the current latest version of GitLab. This can only be checked by executing a pipeline. If it does not work, the log tells me exactly what image it needs an I proceed to pull it.
  
  The image in question is also tagged with a latest tag, which I cannot use, due to the hard dependency to the non-volatile tag.
  
  ```
  $docker image ls
  REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
  gitlab/gitlab-runner-helper   x86_64-8af42251     1ee5a99eba5f        20 hours ago        43.7MB
  gitlab/gitlab-runner-helper   x86_64-latest       1ee5a99eba5f        20 hours ago        43.7MB
  
  ```
  
  **To automate my update process, I'd like to know, how I could pull the latest image with all alternative tags?**
  
  The man page of Docker pull says, there is a `--all-tags` option, to load any tagged image from the repository, but this cannot be combined with a tag.
  
  **Tags:** docker, gitlab, gitlab-ci-runner
  
  > **Comments:**
  > **username_1**: Perhaps https://stackoverflow.com/questions/28320134/how-to-list-all-tags-for-a-docker-image-on-a-remote-registry has the answer you seek?  
  > **username_0**: That is unfortunately not the the answer. I am searching for alternative tags of a single image.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-01-22. Score: 1 | Accepted answer
  
  I posted the [same question at stackoverflow](https://stackoverflow.com/questions/52942359/how-to-pull-all-alternative-tags-of-a-docker-image). The question is answered there and I have posted my script. For the sake of completeness, I will post it here as well.
  
  ```
  #!/bin/sh
  
  TOKEN=`curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:gitlab/gitlab-runner-helper:pull" | jq '.token' | sed 's/"//g'`
  TAGS=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/tags/list -H "Authorization: Bearer $TOKEN" | jq ".tags[]" | sed 's/"//g' | grep x86_64`
  
  for tag in $TAGS;
  do
    # is $tag an old entry?
    if grep -Fxq $tag tags.list
    then
      # already processed
      continue
    else
      echo "new tag found: $tag"
      newSHA=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/manifests/$tag -H "Authorization: Bearer $TOKEN" | jq ".fsLayers[] .blobSum" | sed 's/"//g'`
      latestSHA=`curl -s https://registry.hub.docker.com/v2/gitlab/gitlab-runner-helper/manifests/x86_64-latest -H "Authorization: Bearer $TOKEN" | jq ".fsLayers[] .blobSum" | sed 's/"//g'`
      if [ "$newSHA" = "$latestSHA" ]
      then
        echo "$tag is new latest version"
        docker pull gitlab/gitlab-runner-helper:$tag
        echo $tag >> tags.list
      fi
    fi
  done
  
  ```
  
  The above script utilizes a file named `tags.list`, that is placed next to it. This file contains the older tags, to prevent issuing 500+ HTTP requests. If a tag from the `TAGS` is not yet present in the file, it does not mean, it is the latest. Sometimes tags appear, that eventually will become the latest version. Those tags are probed, but will not be inserted into the file. This might become an issue in the future, if those versions will be skipped as latest.
  
  **Note:** The script above only focuses on a specific subset of tags `(x86_64)`.
  
  
  ---
  
  ### Answer by username_2 on 2018-10-23. Score: 0
  
  You can list all alternative image using the [reg](https://github.com/genuinetools/reg) tool.
  
  > **Comments:**
  > **username_0**: I don't want alternative images. I am searching for alternative tags of a single image.  
  > **username_2**: you can do it also. you can grep all tags by imagename  
  > **username_0**: According to their documentation, the list of the tags does NOT include the image hash and is therefore not suitable for my usecase.  
  
  ---
  
  