question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get permission denied when using docker in self-hosted server

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

54reactions
kdichevcommented, Apr 8, 2020

@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

18reactions
shussoncommented, Aug 20, 2020

make sure you have given permission to the user that will run the github agent like so:

sudo usermod -a -G docker <USER>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker-Compose Permission Denied using Root
Hi, I had no issues running docker, ran a script for something work related (I believe it might've installed another docker instance?)
Read more >
Azure DevOps with self-hosted Ubuntu machine: docker fails
The problem is that the agent service has not the permissions to connect. You can either run the agent service as root (...
Read more >
Why are Docker filesystem permissions behaving ...
1 Answer 1 ... The GitHub Actions probably has designated permissions for the uids/gids that are contained in the tar.gz and also of...
Read more >
Permission Denied While Trying to Connect to the Docker ...
I started to investigate… I logged in to the Linux VM where this particular Self-Hosted Runner is hosted with the same credentials as...
Read more >
How to Fix Docker Permission Denied?
The "Permission Denied" error appears when a system cannot communicate with the Docker daemon because the user lacks privileges.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found