Dev Tools · 2h ago
Fix GitLab CI Docker socket error with DOCKER_HOST variable
GitLab CI jobs fail with "Cannot connect to unix:///var/run/docker.sock" when DOCKER_HOST is unset, causing the Docker client to look for a local socket that doesn't exist inside the job container. Setting DOCKER_HOST to tcp://docker:2376 and adding the docker:dind service resolves the issue. The error differs from the tcp://docker:2375 variant, which indicates a different connectivity problem.
Meridian48 take
The fix is straightforward but the article usefully distinguishes between socket and TCP error messages, saving developers time debugging similar-looking failures.
gitlab-cidocker