I have an internal gitlab project which we run on our server using a docker image. We use a self-signed certificate. We build our project with docker-compose and I’m trying to move this to use gitlab’s CI.
I created gitlab-ce.yml based on the instructions for a docker build here.
I replaced the docker
image with docker/compose
so that docker-compose is available to build with.
Initially there were problems with this failing to login to the registry because of the self-signed certificate. After some investigation, I updated the gitlab-ce.yml
to add an --insecure-registry
option to hopefully get the docker login
command work based on these instructions. Even with that change I still get the same error.
The final gitlab-ce.yml looks like:
docker-build:
image: docker/compose:latest
stage: build
services:
- name: docker:dind
command: ["--insecure-registry=gitlab.object-craft.com.au:5050"]
before_script:
- echo “(token)” | docker login -u referral-manager --password-stdin $CI_REGISTRY
script:
- docker-compose build --pull
- docker tag proxy "$CI_REGISTRY:proxy/$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY:proxy/$CI_COMMIT_REF_SLUG" .
- docker tag referee "$CI_REGISTRY:proxy/$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY:referee/$CI_COMMIT_REF_SLUG" .
- docker tag referral-manager "$CI_REGISTRY:proxy/$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY:referral-manager/$CI_COMMIT_REF_SLUG" .
except:
- master
This still doesn’t work though and in the logs I’m seeing the error:
$ echo “(token)” | docker login -u referral-manager --password-stdin $CI_REGISTRY
time="2020-06-25T04:39:50Z" level=info msg="Error logging in to v2 endpoint, trying next endpoint: Get https://gitlab.object-craft.com.au:5050/v2/: x509: certificate signed by unknown authority"
Get https://gitlab.object-craft.com.au:5050/v2/: x509: certificate signed by unknown authority
I can’t seem to get the magic I need to be able to login to the gitlab registry. Can anyone help?