Hello, I am new on gitlab.com and I want to use GitLab CI to build, push and deploy docker images.
I do use it proficiently at work already, but it’s self-hosted and I reckon there are some differences.
Anyhow, the issue is when I try to login to the registry, I usually do this:
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
But it gives:
Error response from daemon: Client sent an HTTP request to an HTTPS server.
I have tried to replace it with the following:
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
But nothing changes (ofc).
So, I’ve been digging SO, Google, and these are the configurations I have tried:
# 1) Removing certificates (force http, i guess): DOCKER_HOST: tcp://docker:2375 # also tried 2376 DOCKER_TLS_CERTDIR: "" # 2) Adding `overlay2` fs driver DOCKER_TLS_CERTDIR: "" DOCKER_HOST: tcp://docker:2375/ # also tried 2376 DOCKER_DRIVER: overlay2 # 3) Same but with certificates DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_CERTDIR: "/certs" #also tried with empty string DOCKER_DRIVER: overlay2 # 4) Same but without host DOCKER_TLS_CERTDIR: "/certs" #also tried with empty string DOCKER_DRIVER: overlay2
Only “progress” I made is that solution #4, which produced:
error during connect: Post https://X.X.X.X/v1.40/auth: x509: certificate signed by unknown authority
So looks like I can’t connect to the registry. I’m kind of lost…
I would expect the official guide to work out of the box, and I don’t think I am doing anything fancy.
This is my
stages: - build # ... # Also tried: #services: # - docker:19.03.1-dind build: stage: build image: docker:stable # or docker/compose:stable # Also tried: #services: # - docker:dind variables: # ... as seen above before_script: # this fails :( - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - #... build command never reached only: - master - beta
Probably it’s just something small I have been missing, or pheraps not.
Bespoke help would be golden, but I can settle for a link to a “How to
docker login in GitLab CI” guide which works on current version of gitlab.com