I have built a custom docker image from alpine and use it as the base image for ruby services that we develop.
FROM ruby:2.4.2-alpine
…
I created a separate project for the alpine-ruby-service-base
dockerfile. Then build and pushed the image to Gitlab docker registry in the project.
In the other ruby service projects, I reference it as follows
FROM gitlab.mycompany.dk:4567/alpine-ruby-service-base
…
In every servce projects, I have a CI/CD pipeline (.gitlab-ci.yaml) which builds these ruby service images when there is a commit to one of the branches.
- docker login --username=gitlab-ci-token --password=$CI_JOB_TOKEN gitlab.mycompany.dk:4567 - docker build --pull -t $CI_REGISTRY/$CONTAINER_TEST_IMAGE . - docker push $CI_REGISTRY/$CONTAINER_TEST_IMAGE
The problem is that when the CI/CD pipeline is run it fails with the following message
$ docker build --pull -t $CI_REGISTRY/$CONTAINER_TEST_IMAGE .
Sending build context to Docker daemon 709.6kBStep 1/13 : FROM gitlab.mycompany.dk:4567/alpine-ruby-service-base
pull access denied for gitlab.mycompany.dk:4567/alpine-ruby-service-base,
repository does not exist or may require ‘docker login’: denied:
requested access to the resource is denied
docker login --username=gitlab-ci-token --password=$CI_JOB_TOKEN gitlab.mycompany.dk:4567
the login succeeds
but the following docker build instruction fails!!! can someone point me what is going wrong?