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?
@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:
sudo ./svc.sh stop
sudo ./svc.sh start
hope that helps
@kdichev I downgrade to version 1.164.0 and it worked. I think it's the bug of the latest version 1.168.0
Seems the suggestion from @kdichev is correct, it worked me as well. I do not think there is a bug related to this particular problem in latest version. @beetlikeyg087
the permission denied is from docker daemon, looks like a problem with USER/GROUP permission setup, doesn't look like a runner issue to me. I am going to close the issue for now.
make sure you have given permission to the user that will run the github agent like so:
sudo usermod -a -G docker <USER>
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.
Most helpful comment
@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