Cannot connect to the Docker daemon in GitLab CI — Common Causes and Solutions
GitLab CI is a popular continuous integration and delivery platform that is often used to build, test, and deploy code changes. One common error that users may encounter when using GitLab CI is the “Cannot connect to the Docker daemon” error. This error occurs when GitLab CI is unable to connect to the Docker daemon, which is the process that manages Docker containers on the system.
Published in
3 min readJan 30, 2023
You are trying to run Docker in your GitLab CI pipeline, and the following error occurs:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
There are several potential causes for this error, and the solution will depend on the root cause. Here are a few common causes and solutions:
The Docker daemon is not running
This is the most obvious cause of the error, but it can be confusing why this is happening.
If your pipeline looks something like this:
some-job:
image: docker
script:
- docker --version
- docker pull alpine