For example, I have a base dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
...
which I build docker build -t my-base
, then build a second dockerfile:
FROM my-base
...
which works because my-base
is available locally. However, if I push these to a registry, it seems I am forced to replace the second docker file with:
FROM my-dockerhub-accountname/my-base
...
or if not using dockerhub:
FROM 1234.myregistryprovider/something/my-base
...
And likewise doing a docker push -t my-dockerhub-accountname/my-base
or 1234.myregistryprovider/something/my-base
for the first image.
But docker is only ever connected to one registry (this still applies if it was not), why do these registry provder uris have to poison the docker files I write? This makes doing CI considerably harder, binding whatever registry provider we choose to declarations in source code.
By comparison, when I reference a nuget/npm package, I do so by package name while registry is handled by the package source manager. It does not and should not come into the question :/
Is there a way to avoid all this?