Referencing images in a stable way

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. I know there are digests to aid with stability, but these are platform-specific. What if I want my Dockerfile to remain multi-platform and reference a stable base image. 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?

(I asked a similar question on StackOverflow)

I doubt that mutli-plattform builds using multi-plattform base images with mutable tags will allow what you are looking for.

If you are in control of the base image repo: use immutable tags
If you are not in controll of the base iamge repo: ask the maintainer to introduce them.

With mutable tags you end up requiring to pinpoint the exact image by its digestest, which as you already know is not an option for multi-plattform builds.

update: forget a very cruitials “im” in “use immutable tags”

Thanks for the quick reply, I will ask the gcc team and see what (if anything) they have to say to the matter…