0

When pushing a docker image with a modified tag (to contain registry) to the gitlab integrated registry i get an access denied.

arnonuem
  • 1,317
  • 6
  • 19

2 Answers2

0

Using the gitlab registry is using it per project. Once the registry is enabled for a project there is a hint how to push the images to the registry https://gitlab.mydomain.com/**path/to/project**/container_registry.

The problem got solved when the full path was included in the TAG Name.

When i changed the tagname to [registryUrl]:[registryPort]/path/to/project/[imageNameWithTags] i was able to push to the repository/registry.

arnonuem
  • 1,317
  • 6
  • 19
0

Indeed you need to do docker login ... as described on the /container_registry page.

You can also rely on some GitLab Predefined environment variables to make code generic and re-use it in many projects.

Here is the example of doing it in .gitlab-ci.yml:

build-image:
  stage: build
  image: docker:latest
  services:
    - name: docker:dind
  script:
    - docker build -t $CI_REGISTRY_IMAGE .
    - docker login -u $CI_REGISTRY_USER -p "$CI_JOB_TOKEN" $CI_REGISTRY
    - docker push $CI_REGISTRY_IMAGE

See full example in one of our projects

Ivan
  • 9,089
  • 4
  • 61
  • 74
  • I know and I did login but what I didn‘t notice was that i have to push the image to a specific place since there is no generic all in one space in Gitlab. – arnonuem Jun 29 '19 at 14:25
  • Yes, you are pushing exact image name with tag, see: https://docs.docker.com/engine/reference/commandline/push/ – Ivan Jun 29 '19 at 15:21