Hi all,
I have a microservice infrastructure and a base Docker template used as the FROM
in each microservice’s Dockerfile. I’m trying to use Gitlab CI with Docker in Docker to test/build the microservice’s Docker image during the CI process, but I get access forbidden when I try to use the base Docker template:
Running with gitlab-ci-multi-runner 9.3.0 (3df822b)
on gitlab-runner-1 (7e3b99e0)
Using Docker executor with image docker ...
Using docker image sha256:f73a387d8c5edbeaeb6ca443c56c211f6abcf96cc4b5b577e91c0417f5171d99 for predefined container...
Pulling docker image docker ...
Using docker image docker ID=sha256:192e3edb771f334fbc2e1941b43b0b3ecd8545a86744ce8fc2fe98a3d5774273 for build container...
Running on runner-7e3b99e0-project-1-concurrent-0 via gitlab-runner-1...
Fetching changes...
HEAD is now at 844e621 Updated branch
Checking out 844e6214 as master...
Skipping Git submodules setup
$ docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab.myhostname.com
Login Succeeded
$ docker build -t gitlab.myhostname.com:4567/domain/test-microservice:1.0.0 .
Sending build context to Docker daemon 204.3kB
Step 1/3 : FROM gitlab.myhostname.com:4567/domain/microservice-template:1.1
Get https://gitlab.myhostname.com:4567/v2/domain/microservice-template/manifests/1.1: denied: access forbidden
Here’s my .gitlab-ci.yml:
image: docker
stages:
- test
- build
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab.myhostname.com
# Run Unit and Integration tests
test-service-job:
stage: test
tags:
- tag1
script:
- echo "Add testing here"
# Build the docker image and push
build-docker-image-job:
stage: build
tags:
- tag1
script:
- docker build -t gitlab.myhostname.com:4567/domain/test-microservice:1.0.0 .
- docker push gitlab.myhostname.com:4567/domain/test-microservice:1.0.0
only:
- master
Anyone have any idea how to give my Docker container the ability to pull from another registry within Gitlab?