Closed b-ehlers closed 1 year ago
One question, if I want to build & push images to ghcr.io in addition of Docker hub, do I just need to:
true
: https://github.com/GNS3/gns3-registry/pull/774/files#diff-2817fc9ec6443e19233164eefa86576a0972ce81bcf0ec4a04f96d6119db038eR49Thanks 👍
As I wrote in the initial comment: The Docker build tool currently supports building and uploading to multiple registries ONLY by using full image names. Lets assume the docker_images
configuration file looks like this:
test1 ubuntu
docker.io/gns3/test2 ubuntu
ghcr.io/gns3/test3 ubuntu
The test1
image contains only its name, not the repository. In this case the DOCKER_REPOSITORY
environment variable will be used to define which repository to use. The other two lines (docker.io/gns3/test2
and ghcr.io/gns3/test3
) contain the full target repository, so they are used unmodified.
When using DOCKER_REPOSITORY=gns3
the following images will then be build: gns3/test1
(as docker uses docker.io as the default registry this is the same as docker.io/gns3/test1
), docker.io/gns3/test2
and ghcr.io/gns3/test3
.
Now to your questions:
if:
condition to true.
In the current docker settings https://github.com/GNS3/gns3-registry/blob/master/docker/docker_images only name-only target images are used, so only the repository defined by DOCKER_REPOSITORY
is used. That means you need to login only to that repository. As currently the DOCKER_REPOSITORY
is set to the DockerHub repository, only a login to that repository is needed. But, of course, you can additionally login to other repositories. That won't have any effect, as they are currently not used.DOCKER_REPOSITORY
. If you remove both comments of the DOCKER_REPOSITORY
settings, the last one will succeed. This PR does NOT change the behavior of the build tool for building images. Builds to multiple repositories, when using name-only target images, is still not supported. For that see the issue https://github.com/GNS3/gns3-registry/issues/772.Thanks for the explanations! I hadn't seen https://github.com/GNS3/gns3-registry/issues/772
I will keep your PR like this and consider building and uploading to ghcr.io at a later stage. Thanks again for your help.
Thanks. For uploading to multiple repositories this PR is a prerequisite, but more has to be done. Let us discuss the best way to build and upload to multiple repositories in #772.
The Docker build tool already support building and uploading to multiple registries (by using full image names), but it allows to login only into one. This PR supports to login into multiple registries.
While the changes in the tool were quite small, the workflow got quite large changes
if:
condition can be set to false.<registry> <user> <password>
. As before these environment variables are optional and only needed for private repositories.