Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock #2616

Open
clembo590 opened this issue Jan 14, 2025 · 0 comments
Labels
kind/bug Something isn't working

Comments

@clembo590
Copy link

clembo590 commented Jan 14, 2025

Bug report info

act version:            0.2.71
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
        $HOME/.docker/run/docker.sock
Config files:           
        /Users/clement2/Library/Application Support/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
        /Users/clement2/.actrc:
                --container-architecture=linux/amd64
Build info:
        Go version:            go1.23.4
        Module path:           command-line-arguments
        Main version:          
        Main path:             
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -X main.version=0.2.71
                CGO_ENABLED:          1
                CGO_CFLAGS:           
                CGO_CPPFLAGS:         
                CGO_CXXFLAGS:         
                CGO_LDFLAGS:          
                GOARCH:               arm64
                GOOS:                 darwin
                GOARM64:              v8.0
Docker Engine:
        Engine version:        27.4.0
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Docker Desktop
        OS type:               linux
        OS version:            
        OS arch:               aarch64
        OS kernel:             6.10.14-linuxkit
        OS CPU:                8
        OS memory:             24248 MB
        Security options:
                name=seccomp,profile=unconfined
                name=cgroupns

Command used with act

this works

act -P ubuntu-latest=catthehacker/ubuntu:act-latest --env PRIVATE_IP=`ipconfig getifaddr en0` --workflows  .github/workflows/mavenDagger.yml

BUT THIS FAILS:

act -P ubuntu-latest=catthehacker/ubuntu:full-latest --env PRIVATE_IP=`ipconfig getifaddr en0` --workflows  .github/workflows/mavenDagger.yml

Describe issue

when using catthehacker/ubuntu:full-latest I get the following 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.45/containers/json?all=1&filters=%7B%22name%22%3A%7B%22%5E%2Fdagger-engine-%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied

But I do not get it when running same command with catthehacker/ubuntu:act-latest

Link to GitHub repository

git clone https://github.com/clembo590/issues.git --branch issue1_with_act

Workflow content

name: MAVEN DAGGER

on:
  push:
    branches:
      - '**'

jobs:
  build:
    name: Maven Build
    runs-on: ubuntu-latest

    steps:
      - name: LOG GITHUB CONTEXT
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"

      - name: Checkout the code on PR
        uses: actions/checkout@v4
        if: github.event_name == 'pull_request'
        with:
          # Repository name with owner. For example, actions/checkout
          # Default: ${{ github.repository }}
          fetch-depth: 0
          set-safe-directory: true
          ref: ${{ github.event.pull_request.head.ref }}

      - name: Checkout the code on push branch
        uses: actions/checkout@v2
        if: github.event_name == 'push'
        with:
          fetch-depth: 0

      - name: Setup Java 21
        uses: actions/[email protected]
        with:
          java-version: 21
          distribution: 'temurin'

      - name: Get Private IP
        if: env.PRIVATE_IP == ''
        run: |
          # Get the private IP address using `hostname`
          hostname -I
          PRIVATE_IP=$(hostname -I | awk '{print $1}')
          echo "Private IP: $PRIVATE_IP"

          # Save as GitHub output variable if needed
          echo "PRIVATE_IP=$PRIVATE_IP" >> $GITHUB_ENV

      - name: Display Private IP from Environment
        run: echo "Private IP is $PRIVATE_IP"
        

      - name: Call Dagger Function to build and publish to ghcr.io
        uses: dagger/dagger-for-github@v7
        with:
          version: "latest"
          verb: call
          module: .dagger
          # args: build-and-push --registry=$DOCKER_REGISTRY --image-name=$DOCKER_IMAGE_NAME --username=$DOCKER_USERNAME --password=env:DOCKER_PASSWORD --build-context=github.com/daggerverse/dagger-ghcr-demo
          args: maven-build  --socket=/var/run/docker.sock --private-ip=$PRIVATE_IP
        # env:
        #   DOCKER_REGISTRY: ghcr.io
        #   DOCKER_IMAGE_NAME: ${{ github.repository }}
        #   DOCKER_USERNAME: ${{ github.actor }}
        #   # assumes the container registry password is in
        #   # a repository secret named REGISTRY_PASSWORD
        #   # set via the GitHub UI/CL
        #   DOCKER_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

Relevant log output

`permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json?all=1&filters=%7B%22name%22%3A%7B%22%5E%2Fdagger-engine-%22%3Atrue%7D%7D": dial unix /var/run/docker.sock: connect: permission denied` 
this happens when using `catthehacker/ubuntu:full-latest`... and does not happen when using `catthehacker/ubuntu:act-latest `

Additional information

please clone this to reproduce:
git clone https://github.com/clembo590/issues.git --branch issue1_with_act

@clembo590 clembo590 added the kind/bug Something isn't working label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant