runner: get permission denied when using docker in self-hosted server
HI all, I have an issue about using docker in self-hosted server I have a runner installed on ubuntu 18.04 The runner is running with svc.sh And my pipeline is using a docker The docker is already installed in the server and can run without sudo
# my pipeline
name: Go
on:
push:
branches: [ master ]
jobs:
build:
name: Build
runs-on: self-hosted
steps:
- name: check out
uses: actions/checkout@v2
- name: Use go docker
uses: docker://golang:1.13.9-alpine3.10
- name: Run go
run: go run main.go
logs
Pull golang:1.13.9-alpine3.109s
##[error]Docker pull failed with exit code 1
Pull down action image 'golang:1.13.9-alpine3.10'
/usr/bin/docker pull golang:1.13.9-alpine3.10
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/images/create?fromImage=golang&tag=1.13.9-alpine3.10: dial unix /var/run/docker.sock: connect: permission denied
##[warning]Docker pull failed with exit code 1, back off 3.258 seconds before retry.
/usr/bin/docker pull golang:1.13.9-alpine3.10
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/images/create?fromImage=golang&tag=1.13.9-alpine3.10: dial unix /var/run/docker.sock: connect: permission denied
##[warning]Docker pull failed with exit code 1, back off 5.8 seconds before retry.
/usr/bin/docker pull golang:1.13.9-alpine3.10
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/images/create?fromImage=golang&tag=1.13.9-alpine3.10: dial unix /var/run/docker.sock: connect: permission denied
##[error]Docker pull failed with exit code 1
any idea?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (1 by maintainers)
@beetlikeyg087 I found your issue while trying to fix the same problem I managed to make the action run the docker command itself by also restarting the service with:
hope that helps
make sure you have given permission to the user that will run the github agent like so:
I also had to restart the github runner service after adding the user to docker group.
One addition to @shusson 's comment. If you had to create the docker group to add your USER, then you may need to restart the docker daemon before it will grant permissions to that group.
I was running a pretty basic Ubuntu 18 on AWS and needed to do this.
Same as @prashantkalkar, I had to restart the self-hosted runner service after adding the user I created the runner on the system with.
For posterity…
(cd into your self-hosted runners’ directory first obvs…)
sudo ./svc.sh stop
thensudo ./svc.sh start
Bingo Bango! That’s all you need!
I give you exact command in my comment 😃
sudo svc.sh install
Sorry for the lame comment but I am using
./run.sh
as instructed by github while creating action runners. When I try to runsudo ./svc.sh start
it saysFailed to start actions.runner.sarvpriy-sample-ms-test.sarvpriy-pc.service: Unit actions.runner.sarvpriy-sample-ms-test.sarvpriy-pc.service not found. Failed: failed to start actions.runner.sarvpriy-sample-ms-test.sarvpriy-pc.service
What do
svc.sh
do?