Docker "permission denied while trying to connect to the Docker daemon socket"
Your CI user does not have permission to talk to /var/run/docker.sock, or the Docker daemon is not running at all.
What this error means
Any docker command fails immediately, before doing any work, complaining it cannot connect to the daemon socket.
Terminal
permission denied while trying to connect to the Docker daemon socket at
unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/...":
dial unix /var/run/docker.sock: connect: permission deniedCommon causes
User is not in the docker group
The socket is owned by the docker group. A user outside that group cannot access it without sudo.
The Docker daemon is not running
In some container-based runners Docker is not started by default, so there is no daemon to connect to.
How to fix it
Add the user to the docker group
Terminal
sudo usermod -aG docker "$USER"
# the group change applies to new shells; in a single CI step use:
sudo chmod 666 /var/run/docker.sock # CI-only shortcutMake sure the daemon is up
Terminal
sudo systemctl start docker
# or, where systemd is unavailable:
sudo dockerd > /tmp/dockerd.log 2>&1 &How to prevent it
- Use a runner image where Docker is preinstalled and the CI user is already in the docker group.
- Start the daemon explicitly as the first step in container-based runners.