I have 2 EC2s, one with Gitlab-ee installed, another with Docker installed and running Gitlab-Runner and a Registry container.
Gitlab-Runner is working, and picks up the commit to Gitlab, shipping it to docker for it's build phase. However during the build phase when the docker container attempts to login to the Registry container it errors with "http: server gave HTTP response to HTTPS client"
Docker Login code:
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
Troubleshooting done:
sudo docker login localhost:5000Software verions:
If anyone could help me on this, it would be greatly appreciated! I've been banging my head against it for 2 days.
I believe this question is lack of details to give you exactly the solution you need. Anyway, I'll try to outline some of issues you might faced.
The message "http: server gave HTTP response to HTTPS client" exactly tells that HTTPS client (that is docker login) is expecting TLS (HTTPS) server on socket localhost:5000.
However your registry server is configured with HTTP only and doesn't support TLS. So that's why you server returns HTTP response to HTTPS client.
To solve that follow this official docker guide.
This case is worth to read if you use docker executor in gitlab-runner. It means that your gitlab-runner creates new container for every incoming job.
You didn't share the value of CI_REGISTRY variable.
However, I suppose it might be equal to localhost or domain name.
Please, note that localhost in container is different from host's localhost because they're located in different network namespaces.
If you set a value of domain name, be sure this domain name is resolvable in container namespace.
You marked that you've tried --insecure-registries flag but with no success.
Be sure you've configured it for container's Docker daemon, not host's Docker.
It's exactly the truth if you go along with Docker-in-Docker image for jobs which basically runs a separate Docker daemon.
Hope this information would be useful to anyone who still stuggles...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With