nektos / act

Run your GitHub Actions locally 🚀
https://nektosact.com
MIT License
51.87k stars 1.3k forks source link

Getting dial unix /var/run/docker.sock: connect: permission denied #2336

Open znewsham opened 1 month ago

znewsham commented 1 month ago

Bug report info

act version:            0.2.61
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 20
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
    /var/run/docker.sock
Config files:           
    /home/zacknewsham/snap/gh/502/.config/act/actrc:
        -P ubuntu-latest=catthehacker/ubuntu:act-latest
        -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
        -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
        -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
    Go version:            go1.20.14
    Module path:           github.com/nektos/act
    Main version:          (devel)
    Main path:             github.com/nektos/act
    Main checksum:         
    Build settings:
        -buildmode:           exe
        -compiler:            gc
        -trimpath:            true
        CGO_ENABLED:          0
        GOARCH:               amd64
        GOOS:                 linux
        GOAMD64:              v1
        vcs:                  git
        vcs.revision:         e8856f0fb00fcdd16eef2325b845f55f5d346f51
        vcs.time:             2023-08-21T16:17:06Z
        vcs.modified:         true

Error: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied

Command used with act

Any act command - including `gh act --bug-report`

Describe issue

My user has permission to access /var/run/docker.sock - I've also tried each of the workarounds listed here: https://github.com/nektos/act/issues/1798

I cannot get gh act to run.

  1. Is the github extension not supported?
  2. Would I have this problem using a different install?
  3. Is this error coming from the host - or from a container somehow?
  4. Which user is this running as (I'd assumed my own, but perhaps it isn't)

I've tried chowning it too. docker ps runs just fine

ls -lha /var/run/docker.sock 
srw-rw-rw- 1 root docker 0 Apr  9 17:29 /var/run/docker.sock

Link to GitHub repository

No response

Workflow content

n/a

Relevant log output

n/a

Additional information

No response

znewsham commented 1 month ago

Confirmed, after fighting a ludicrous amount with nix - I got act installed there and don't see the issue. Seems this is specific to gh act

ChristopherHX commented 1 month ago

home/zacknewsham/snap/gh/502

Is your gh cli a canonical snap? The whole point of snap/flatpak is sandboxing or more so it's expected that the app has no longer access to the socket as the permissings are reduced to gain security

From my experience sandboxes hinder local development for those writing code.

znewsham commented 1 month ago

It is - I wasn't aware there was a way to install github actions without snaps (I hate snaps anyway)