nkg
nkg

Reputation: 961

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

Upvotes: 3

Views: 4909

Answers (1)

nkg
nkg

Reputation: 961

How to resolve this issue:

usermod -aG docker gitlab-runner
sudo service docker restart

Upvotes: 5

Related Questions