How to fix Gitlab Runner 'dial unix /var/run/docker.sock: connect: permission denied'
Problem:
In your Gitlab build jobs that use docker you see error messages like
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/auth: dial unix /var/run/docker.sock: connect: permission denied
Solution
usermod -a -G docker gitlab-runner
to give the user running the jobs permission to access docker resources then restart the server/VM on which the runner is installed !
Still doesn’t work? Check if you have installedĀ docker
correctly. We recommend to use our automated install script, seeĀ How to install docker and docker-compose on Ubuntu in 30 seconds.