skip to Main Content

I am currently building a docker image on top of gcc:11. All the (newer) tags are pushed to (relatively) frequently which becomes annoying when my image build suddenly starts from base. Some docker registries offer dated tags (like foo:3.0.1-20220714 for stability, which are never pushed to again. Gcc does not. Is there any other way to reference a tag in a stable way (like a git commit)? Or are tags just overwritten in the repository and that is why it is physically impossible?

EDIT: I forgot to mention this build is multi-platform, so I cannot reference by digest.

2

Answers


  1. Chosen as BEST ANSWER

    To answer my own question: This is now solved thanks to @yosifkit on Github: use the docker manifest tool. Here is the original answer.

    It can extract a digest which is not platform specific.


  2. From https://docs.docker.com/engine/reference/commandline/pull/ :

    Pull an image by digest (immutable identifier)

    So far, you’ve pulled images by their name (and “tag”). Using names
    and tags is a convenient way to work with images. When using tags, you
    can docker pull an image again to make sure you have the most
    up-to-date version of that image. For example, docker pull
    ubuntu:20.04 pulls the latest version of the Ubuntu 20.04 image.

    In some cases you don’t want images to be updated to newer versions,
    but prefer to use a fixed version of an image. Docker enables you to
    pull an image by its digest. When pulling an image by digest, you
    specify exactly which version of an image to pull. Doing so, allows
    you to “pin” an image to that version, and guarantee that the image
    you’re using is always the same.

    […]

    docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
    

    […]

    FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search