In a project with several references to certain Docker-images I want to provide a versionable (i.e git-trackable) way to use common names for Docker-images.
Currently at several places in an existing project some Bash/Python-scripts, Docker-files or Jenkins-files I'm referencing e.g. busybox:latest
. Now I want to use readable names for unique images without redundancy instead.
As far as I understand I could use my own registry, provide a readable tag and just use the tag or the right repo-digest:
docker pull busybox:latest
docker tag busybox:latest my_registry/busybox:default
docker push my_registry/busybox:default
# use
docker pull busybox@sha256:dca712...86b <- has to be maintained manually
# or
docker pull my_registry/busybox:default <- not updateable or not unique for given commit
But now I also want the distinct sha1s behind also be update-able and git-trackable (without having to redundantly write the sha everywhere). Maybe I'm not using the correct wording but what I need could be achieved by using a text-file containing some sort of "aliases", e.g.
docker_aliases.txt:
my_registry/busybox_default sha256:dafhs3ca712...3486b
my_registry/ubuntu-20.04 sha256:6a507907bd4e...a50
which could then somehow be used with all Docker-calls which involve pulling images and would allow me to
- use
my_registry/busybox_default
as image specifier at all places - have one place to update those aliases
- which could be tracked by git (very important)
It feels like everyone who's maintaining some larger CI should come across this problem. Is there a general solution for this?
Dockerfile
with just a FROM directive?