vegardit / docker-gitea-act-runner

Docker image based on debian:stable-slim to run Gitea's act_runner as a Docker container
https://buymeacoffee.com/vegardit
Apache License 2.0
171 stars 19 forks source link

Error: daemon Docker Engine socket not found and docker_host config was invalid #17

Closed xiaoxinpro closed 1 year ago

xiaoxinpro commented 1 year ago

Version:

gitea/act_runner:0.2.1

Docker-compose:

version: "3"

services:
  actrunner:
    image: gitea/act_runner:0.2.1
    container_name: actrunner
    restart: always
    volumes:
      - ./data/act_runner:/data
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      TZ: 'Asia/Shanghai'
      CONFIG_FILE: '/data/config.yaml'
      GITEA_INSTANCE_URL: 'https://git.test.com'
      GITEA_RUNNER_REGISTRATION_TOKEN: '**********************************************'

Docker-compose Logs

actrunner  | time="2023-06-30T14:02:36Z" level=info msg="Starting runner daemon"
actrunner  | Error: daemon Docker Engine socket not found and docker_host config was invalid
actrunner  | time="2023-06-30T14:02:42Z" level=info msg="Starting runner daemon"
actrunner  | Error: daemon Docker Engine socket not found and docker_host config was invalid
xiaoxinpro commented 1 year ago

gitea/act runner:0.1.8 starts normally with the same configuration

sebthom commented 1 year ago

The docker image gitea/act_runner you are using is not related to this repository. This repository builds the image named vegardit/gitea-act-runner.

Please report your issue at https://gitea.com/gitea/act_runner/issues instead.

7IXKTUIV1 commented 1 year ago

I'm also getting the same error running: vegardit/gitea-act-runner:latest

level=info msg="Registering runner, arch=amd64, os=linux, version=v0.2.1."
level=warning msg="Runner in user-mode."
level=warning msg="env GITEA_RUNNER_ENV_FILE has been ignored because config file is used"
level=info msg="Runner name is empty, use hostname '8f101f4eeae2'."
level=debug msg="Successfully pinged the Gitea instance server"
level=info msg="Runner registered successfully."
time="2023-07-02T07:14:44" level=info msg="Starting runner daemon"
Error: daemon Docker Engine socket not found and docker_host config was invalid

This is part of the docker-compose:

runner:
    image: vegardit/gitea-act-runner:latest
    container_name: gitea_runner
    depends_on:
      - giteaserver
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:rw
      - /home/gituser/docker/gitea/data/act_runner:/data:rw
    environment:
      - GITEA_INSTANCE_URL=http://192.168.1.150:3000
      - GITEA_RUNNER_REGISTRATION_TOKEN=****************************
sebthom commented 1 year ago

This seems to be a bug in the latest act runner binary release itself, there seems to be a commit https://gitea.com/gitea/act_runner/commit/f2629f2ea3cbf665dc32961671dfb5a8f629e601 that will address this issue in the next release. So please downgrade to 0.2.0 and wait for the 0.2.2 release. Alternatively set the GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST environment variable which also seems to solve the issue.

wblew commented 1 year ago

There is a workaround for this https:gitea.com/gitea/act_runner issue within the vegardit/gitea-act-runner image. Add this to your docker-compose.yml file:

    environment:
      GITEA_RUNNER_JOB_CONTAINER_DOCKER_HOST: "unix:///var/run/docker.sock"

See: https://github.com/vegardit/docker-gitea-act-runner/blob/6b859904150e3f53a4dd4ebf16bc4c10bd1b291c/image/config.template.yaml#L68-L72

It seems that If it's empty, act_runner will find an available docker host automatically is failing. It is probably fixed by this https://gitea.com/gitea/act_runner/commit/f2629f2ea3cbf665dc32961671dfb5a8f629e601 commit.