Dagger "permission denied /var/run/docker.sock" in CI
The Dagger Engine reaches Docker through /var/run/docker.sock. If the CI user is not in the docker group or the mounted socket has restrictive permissions, the connection is refused with "permission denied".
What this error means
dagger fails with "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock".
dagger
Error: failed to connect to engine: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/...": dial unix /var/run/docker.sock: connect: permission deniedCommon causes
The CI user is not in the docker group
The socket is owned by the docker group. A user outside it cannot read or write the socket.
A restrictively mounted socket
When the socket is mounted into a container, its ownership may not match the in-container user, so access is denied.
How to fix it
Grant socket access to the user
- Add the CI user to the docker group, or run the step with sufficient privileges.
- Confirm
docker infosucceeds as that user before dagger. - Re-run dagger once the socket is accessible.
Terminal
sudo usermod -aG docker "$USER"
docker infoFix socket ownership in a container
When mounting the socket into a container, run as a user that matches the socket group so access is permitted.
How to prevent it
- Run dagger as a user with Docker socket access.
- Match container user to the mounted socket group.
- Verify
docker infobefore invoking dagger.
Related guides
Dagger "failed to connect to engine" in CIFix Dagger "failed to connect to engine" in CI - the Dagger CLI could not reach its engine container, usually…
Dagger "failed to start engine" in CIFix Dagger "failed to start engine" in CI - the engine container was created but could not initialize, often…
Earthly "could not connect to buildkitd" in CIFix Earthly "could not connect to buildkitd" in CI - Earthly needs a running BuildKit daemon, and the CI job…