Every GitLab project has its own container registry, and it is possible to upload many images there.
Usually in new projects this feature is enabled by default, but in case it is not:
Settings
-> General
Visibility
, project features
, permissions
& enable Container Registry
Packages
> Container Registry
to check that is has been enabled.In order to push to the registry of a project, you need to connect to it with the following Docker command:
docker login registry.git.rwth-aachen.de
GitLab username & password are needed.
To build a new image from scratch you just need to specify its tag in the scheme that follows:
docker build -t registry.git.rwth-aachen.de/<group>/<project>(/image:version) .
Needs to be inside the folder where the Dockerfile is.
The < image > as well as the < version > fields are optional and can be omitted.
To use an image that already exists, you just have to tag it with an appropriate name:
docker tag <NAME_OF_ALREADY_EXISTING_IMAGE> registry.git.rwth-aachen.de/<group>/<project>(/image:version)
The < image > can be the same as <NAME_OF_ALREADY_EXISTING_IMAGE>.
The < image > as well as the < version > fields can be omitted.
Finally, to push the image to the project’s container registry:
docker push registry.git.rwth-aachen.de/<group>/<project>/<image>
step
docker login registry.git.rwth-aachen.de
Note: Only the first time you will be asked for a username and password (used in GitLab instance).
step
docker build -t registry.git.rwth-aachen.de/ioannis.papagiannidis/ci-hello-world/my_image1 .
step
docker push registry.git.rwth-aachen.de/ioannis.papagiannidis/ci-hello-world/my_image1
step
docker login registry.git.rwth-aachen.de
Only the first time you will be asked for a username and password (used in GitLab instance).
step
sudo docker tag alpine registry.git.rwth-aachen.de/ioannis.papagiannidis/ci-hello-world/tagged_existing_image
step
sudo docker push registry.git.rwth-aachen.de/ioannis.papagiannidis/ci-hello-world/tagged_existing_i