Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when executing docker commands from Gitlab CI/CD pipeline

A CI/CD pipeline is setup in the gitlab with runner on Ubuntu 18.04, with shell executor. When executing docker commands from the pipeline scripts permission denied error is being thrown.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Already added the gitlab-runner user to the root group still the issue is not resolved.

gitlab-runner is already running as root user also.

root      4534  0.5  2.2  36908 23060 ?        Ssl  14:02   0:02 /usr/lib/gitlab-runner/gitlab-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner

Any help to resolve this is greatly appreciated

Figured out the answer usermod -aG docker gitlab-runner sudo service docker restart

like image 640
3lokh Avatar asked Feb 03 '26 15:02

3lokh


1 Answers

How to resolve this issue:

usermod -aG docker gitlab-runner
sudo service docker restart
like image 168
3lokh Avatar answered Feb 06 '26 07:02

3lokh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!