vegardit / docker-gitea-act-runner

Docker image based on debian:stable-slim to run Gitea's act_runner as a Docker container

Home Page:https://buymeacoffee.com/vegardit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

patsaindon opened this issue · comments

I must do : sudo chmod 666 /var/run/docker.sock to be able to build docker image in the container.

I get "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/version": dial unix /var/run/docker.sock: connect: permission denied"

Hello, i have the same problem .... did you solve it @patsaindon ?

This worked for me #23 (comment)

It doesn't seem like the proper way to open it up though since I don't think this persists across reboots

Same issue here. I am looking for an alternative to the default gitea act-runner (that works). But when I run this with my docker-compose it fails. Here is the docker compose, I know it needs some more things, but as it is it fails to ping docker (with and without privileged).

version: "3"

services:  
  runner1:
    image: vegardit/gitea-act-runner:latest
    privileged: false
    container_name: gitea_runner1
    environment:
      GITEA_INSTANCE_URL: "http://gitea:3000"
      GITEA_RUNNER_REGISTRATION_TOKEN: "TOKEN"
      GITEA_RUNNER_NAME: "runner1"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:rw

Container logs

14:23:16 INFO [/opt/run.sh:132] Fixing permissions...
14:23:16 INFO [/opt/fix_permissions.sh:61] Adding user [act] to docker group [root:x:0:]...
14:23:16 INFO [/opt/run_runner.sh:10] Effective user: uid=1000(act) gid=1000(act) groups=1000(act),0(root),27(sudo),100(users)
15:23:16 time="2024-02-14T14:23:16Z" level=info msg="Starting runner daemon"
15:23:16 Error: cannot ping the docker daemon, does it running? permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied

Two ways to solve this issue.

  1. Change GITEA_RUNNER_LABELS to ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04,ubuntu-20.04:docker://catthehacker/ubuntu:act-20.04. If you are changing an already working worker, change the file content in ./data/.runner

Those images are basically the same as the default one, but the job container will run as root instead of runner

Or

  1. Manually add a step to your workflow to fix the permission problem.
    steps:
    - uses: https://github.com/imlonghao/gitea-runner-docker-permission-fix@main

Codes are coming from fix_permissions.sh

Changing the labels then reregistering solved it for me!

Why isn't this documented anywhere in the main readme (using the -act image instead of the default -runner one?

I had to use a hack to get it working before (I basically had a hack fix to run chmod 666 /run/user/1000/docker.sock every 15 minutes)