Act_runner in docker fails to start

Dear gitea Community,

I’m trying to setup gitea + act_runner in a dockerized environment via docker-compose.
Detting up gitea itself was a breeze and it works some out of the box.
Unfortunately this is not true for actions/act_runner. Altough I tried hard to find a solution, there is not so much written about it (yet).

The issue I’m facing is, that the act_runner container doesn’t start or to be more precise stops with following msg:

runner-1  | time="2024-02-21T14:13:39Z" level=info msg="Starting runner daemon"
runner-1  | time="2024-02-21T14:13:39Z" level=error msg="fail to invoke Declare" error="unavailable: dial tcp: lookup server on 127.0.0.11:53: no such host"
runner-1  | Error: unavailable: dial tcp: lookup server on 127.0.0.11:53: no such host
runner-1 exited with code 1

I tried already various things (config, docker-settings, etc.), but nothing really helped.

I assume you will need some details about my setup.

It is based on a debian bookwork server.
Docker Version:

Docker version 25.0.3, build 4debf41

This is my docker-compose.yml file:

version: "3"

services:
  gitserver:
    image: gitea/gitea:1.21.4-rootless
    hostname: gitserver
    restart: unless-stopped
    user: "1001"
    volumes:
      - ./data:/var/lib/gitea
      - ./config:/etc/gitea
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "80:80"
      - "443:443"
      - "2222:2222"
    networks:
      - gitea_network

  runner:
    image: gitea/act_runner:latest
    hostname: runner
    environment:
      CONFIG_FILE: /act_runner_config.yaml
      TZ: "Europe/Berlin"
      GITEA_INSTANCE_URL: "https://gitserver/"
      GITEA_RUNNER_REGISTRATION_TOKEN: "XXXXXXXXXXXXXXXXXX"
      GITEA_RUNNER_NAME: "Act-Runner"
      #GITEA_RUNNER_LABELS: "default"
    depends_on:
      - gitserver
    links:
      - "gitserver:gitserver"
    volumes:
      - ./config/config.yaml:/config.yaml
      - ./data:/data
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - "gitea_network"

networks:
  gitea_network:
    external: true

The network has been priorly created via

docker network create -d bridge gitea_network

As you can see, nothing special. Just a standard setup…

Your help is really appreciated.

It should be quite easy to replicate this setup.
Just create a project directory, create the necessary directories, copy & paste my docker-compose.yml…

Assuming you are on a *nix machine and have docker installed:

mkdir -p my_test_dir/{config,data}
cd my_test_dir
docker network create -d bridge gitea_network
touch docker-compose.yml # then copy my data above into it
docker compose up

A hint or tip would be really helpfull.

As nobody was able to help and maybe others face the same issue too:
Further investigations showed that the issue is actually related to Alpine.
Seems like that Apline has a know issue with name resolutions in some versions.

Starting up the act_runner container you need to use this additional setting “–dns-option=ndots:0” to avoid the mentioned issue above.

A start command could look like this (you will need to setup the ‘gitea_network’ network first):

docker run -it --rm --dns-option=ndots:0 \
-e CONFIG_FILE=/config.yaml \
-e GITEA_INSTANCE_URL="https://<your giteas service>/" \
-e GITEA_RUNNER_REGISTRATION_TOKEN="XXXXXXX" \
-e GITEA_RUNNER_NAME="Act-Runner" \
-v /home/git/docker/config.yaml:/config.yaml \
-v /home/git/docker/gitea/data=/data \
-v /var/run/docker.sock=/var/run/docker.sock \
--network gitea_network gitea/act_runner:latest

It seems like that this setting is not available in docker-compose.yml files.
You can also use this as global setting for your docker setup, but as this could impact all containers, it isn’t an option for me.

I most probably start building my own images based on debian, because a slightly larger image with full functionality works atm better for me.
Maybe gitea can offer official images with alternatives to alpine in future.

Hope this helps somebody.