Docker-in-Docker GitLab CI file fails (cannot connect to the Docker daemon at unix:///var/run/docker.sock)
Possibly due to gitlab#423? When running a Docker-in-Docker CI file, it fails due to not being able to connect to the Docker daemon: ```bash Running with gitlab-runner 10.5.0 (80b03db9) on gitlab-gitlab-runner-7d7c9dcbbc-5nc7v 22b9e572 Using Kubernetes namespace: default Using Kubernetes executor with image docker:latest ... Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Waiting for pod default/runner-22b9e572-project-21-concurrent-0hlctz to be running, status is Pending Running on runner-22b9e572-project-21-concurrent-0hlctz via gitlab-gitlab-runner-7d7c9dcbbc-5nc7v... Cloning repository... Cloning into '/kevin/ci-test'... Checking out a07a64b3 as master... Skipping Git submodules setup $ docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY WARNING! Using --password via the CLI is insecure. Use --password-stdin. Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/ Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1 ``` GitLab CI file (taken verbatim from the built-in Docker template): ```yaml # This file is a template, and might need editing before it works on your project. # Official docker image. image: docker:latest services: - docker:dind before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY build-master: stage: build script: - docker build --pull -t "$CI_REGISTRY_IMAGE" . - docker push "$CI_REGISTRY_IMAGE" only: - master build: stage: build script: - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" except: - master ``` Dockerfile (shouldn't affect anything, since it fails on `docker login`, but just for completeness's sake): ```dockerfile # This file is a template, and might need editing before it works on your project. FROM node:7.9 WORKDIR /usr/src/app CMD [ "npm", "start" ] # replace this with your application's default port EXPOSE 8888 ``` I *have* set `gitlab.gitlab-runner.runners.privileged = true`, so I don't think it's a configuration error.
issue