Permission denied with shell when running with gitlab-runner start, working with gitlab-runner run

When I use gitlab-runner to build docker image, it report error like this “unix /var/run/docker.sock: connect: permission denied”

It because when we run with gitlab-runner, it will use user named gitlab-runner to run, you can find it with this command

1
cut -d : -f 1 /etc/passwd

But user gitlab-runner it not own docker group, we can use this command to join the docker group

1
sudo gpasswd -a gitlab-runner docker

OK, it will be resolved, enjoy it.

Author: Gavin Zhao
Link: https://www.gavinz.xyz/2020/08/21/permission-denied-with-shell-when-running-with-gitlab-runner-start-working-with-gitlab-runner-run/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.