runners, docker-compose and names resolving #14203

Open
opened 2025-11-02 11:06:13 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @PantinEcarlate on GitHub (Feb 28, 2025).

Description

Hello, I'm writing here because I have a severely persistent error in my instance.

I've started a Docker-Compose installation to create a self-hosted CI/CD pipeline on my end. Unfortunately, I have a particularly stubborn name resolution error among my Docker containers and I can't seem to resolve it.

Here's my Docker-Compose in its entirety:

services:
  db:
    environment:
      - MYSQL_DATABASE=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    image: docker.io/library/mysql:8
    networks:
      - gitea_network
    ports:
      - '3306:3306'
    restart: always
    volumes:
      - ./mysql:/var/lib/mysql
    build:
      args: {}
  runner:
    container_name: runner
    depends_on:
      - server
      - db
    environment:
      GITEA_INSTANCE_URL: http://server:3000
      GITEA_RUNNER_NAME: runner_v1
      GITEA_RUNNER_REGISTRATION_TOKEN: none_yet
    image: gitea/act_runner:nightly
    networks:
      - gitea_network
    restart: always
    volumes:
      - ./data:/data
      - /var/run/docker.sock:/var/run/docker.sock
  server:
    container_name: gitea
    depends_on:
      - db
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=mysql
      - GITEA__database__HOST=db:3306
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=root
      - GITEA__database__PASSWD=gitea
    image: docker.io/gitea/gitea:1.23.4
    networks:
      - gitea_network
    ports:
      - '3000:3000'
      - '222:22'
    restart: always
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
  sonarqube:
    container_name: sonarqube
    image: sonarqube:latest
    networks:
      - gitea_network
    ports:
      - '9000:9000'
    restart: always
    volumes:
      - ./sonarqube_data:/opt/sonarqube/data
      - ./sonarqube_logs:/opt/sonarqube/logs
      - ./sonarqube_extensions:/opt/sonarqube/extensions
    depends_on:
      - runner
networks:
  gitea_network:
    driver: ''
    external: true

With this configuration, here's what I do:
I register my runner with the runner tokens from gitea and once the container is restarted, gitea tells me that the runner is registered and inactive.

The problem comes when I execute a gitea-action. Here's the test script to create a first action in gitea. In my case, the error occurs at checkout.

Here's my action:

name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]

jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
      - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v4
      - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ gitea.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

And here's my error :

[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +73bb88b8de72706e90859bf5ada1344db2f89eb4:refs/remotes/origin/main
fatal: unable to access 'http://server:3000/Tristan/Python-test/': Could not resolve host: server
::remove-matcher owner=checkout-git::
::error::The process '/usr/bin/git' failed with exit code 128

Gitea Version

1.23.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

Image

Git Version

No response

Operating System

docker

How are you running Gitea?

Gitea runs on docker, installed with a docker-compose file which is :

services:
  db:
    environment:
      - MYSQL_DATABASE=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    image: docker.io/library/mysql:8
    networks:
      - gitea_network
    ports:
      - '3306:3306'
    restart: always
    volumes:
      - ./mysql:/var/lib/mysql
    build:
      args: {}
  runner:
    container_name: runner
    depends_on:
      - server
      - db
    environment:
      GITEA_INSTANCE_URL: http://server:3000
      GITEA_RUNNER_NAME: runner_v1
      GITEA_RUNNER_REGISTRATION_TOKEN: none_yet
    image: gitea/act_runner:nightly
    networks:
      - gitea_network
    restart: always
    volumes:
      - ./data:/data
      - /var/run/docker.sock:/var/run/docker.sock
  server:
    container_name: gitea
    depends_on:
      - db
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=mysql
      - GITEA__database__HOST=db:3306
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=root
      - GITEA__database__PASSWD=gitea
    image: docker.io/gitea/gitea:1.23.4
    networks:
      - gitea_network
    ports:
      - '3000:3000'
      - '222:22'
    restart: always
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
  sonarqube:
    container_name: sonarqube
    image: sonarqube:latest
    networks:
      - gitea_network
    ports:
      - '9000:9000'
    restart: always
    volumes:
      - ./sonarqube_data:/opt/sonarqube/data
      - ./sonarqube_logs:/opt/sonarqube/logs
      - ./sonarqube_extensions:/opt/sonarqube/extensions
    depends_on:
      - runner
networks:
  gitea_network:
    driver: ''
    external: true

Database

MySQL/MariaDB

Originally created by @PantinEcarlate on GitHub (Feb 28, 2025). ### Description Hello, I'm writing here because I have a severely persistent error in my instance. I've started a Docker-Compose installation to create a self-hosted CI/CD pipeline on my end. Unfortunately, I have a particularly stubborn name resolution error among my Docker containers and I can't seem to resolve it. Here's my Docker-Compose in its entirety: ``` services: db: environment: - MYSQL_DATABASE=gitea - MYSQL_USER=gitea - MYSQL_PASSWORD=gitea - MYSQL_ROOT_PASSWORD=gitea - MYSQL_DATABASE=gitea image: docker.io/library/mysql:8 networks: - gitea_network ports: - '3306:3306' restart: always volumes: - ./mysql:/var/lib/mysql build: args: {} runner: container_name: runner depends_on: - server - db environment: GITEA_INSTANCE_URL: http://server:3000 GITEA_RUNNER_NAME: runner_v1 GITEA_RUNNER_REGISTRATION_TOKEN: none_yet image: gitea/act_runner:nightly networks: - gitea_network restart: always volumes: - ./data:/data - /var/run/docker.sock:/var/run/docker.sock server: container_name: gitea depends_on: - db environment: - USER_UID=1000 - USER_GID=1000 - GITEA__database__DB_TYPE=mysql - GITEA__database__HOST=db:3306 - GITEA__database__NAME=gitea - GITEA__database__USER=root - GITEA__database__PASSWD=gitea image: docker.io/gitea/gitea:1.23.4 networks: - gitea_network ports: - '3000:3000' - '222:22' restart: always volumes: - ./gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro sonarqube: container_name: sonarqube image: sonarqube:latest networks: - gitea_network ports: - '9000:9000' restart: always volumes: - ./sonarqube_data:/opt/sonarqube/data - ./sonarqube_logs:/opt/sonarqube/logs - ./sonarqube_extensions:/opt/sonarqube/extensions depends_on: - runner networks: gitea_network: driver: '' external: true ``` With this configuration, here's what I do: I register my runner with the runner tokens from gitea and once the container is restarted, gitea tells me that the runner is registered and inactive. The problem comes when I execute a gitea-action. Here's the test script to create a first action in gitea. In my case, the error occurs at checkout. Here's my action: ``` name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: [push] jobs: Explore-Gitea-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - name: Check out repository code uses: actions/checkout@v4 - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ gitea.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." ``` And here's my error : ``` [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +73bb88b8de72706e90859bf5ada1344db2f89eb4:refs/remotes/origin/main fatal: unable to access 'http://server:3000/Tristan/Python-test/': Could not resolve host: server ::remove-matcher owner=checkout-git:: ::error::The process '/usr/bin/git' failed with exit code 128 ``` ### Gitea Version 1.23.4 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots ![Image](https://github.com/user-attachments/assets/4c599610-94f6-4dac-949c-53b1ddbbc3cd) ![Image](https://github.com/user-attachments/assets/6e94e1a5-672e-46d7-b588-3d9d13b80e23) ### Git Version _No response_ ### Operating System docker ### How are you running Gitea? Gitea runs on docker, installed with a docker-compose file which is : ``` services: db: environment: - MYSQL_DATABASE=gitea - MYSQL_USER=gitea - MYSQL_PASSWORD=gitea - MYSQL_ROOT_PASSWORD=gitea - MYSQL_DATABASE=gitea image: docker.io/library/mysql:8 networks: - gitea_network ports: - '3306:3306' restart: always volumes: - ./mysql:/var/lib/mysql build: args: {} runner: container_name: runner depends_on: - server - db environment: GITEA_INSTANCE_URL: http://server:3000 GITEA_RUNNER_NAME: runner_v1 GITEA_RUNNER_REGISTRATION_TOKEN: none_yet image: gitea/act_runner:nightly networks: - gitea_network restart: always volumes: - ./data:/data - /var/run/docker.sock:/var/run/docker.sock server: container_name: gitea depends_on: - db environment: - USER_UID=1000 - USER_GID=1000 - GITEA__database__DB_TYPE=mysql - GITEA__database__HOST=db:3306 - GITEA__database__NAME=gitea - GITEA__database__USER=root - GITEA__database__PASSWD=gitea image: docker.io/gitea/gitea:1.23.4 networks: - gitea_network ports: - '3000:3000' - '222:22' restart: always volumes: - ./gitea:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro sonarqube: container_name: sonarqube image: sonarqube:latest networks: - gitea_network ports: - '9000:9000' restart: always volumes: - ./sonarqube_data:/opt/sonarqube/data - ./sonarqube_logs:/opt/sonarqube/logs - ./sonarqube_extensions:/opt/sonarqube/extensions depends_on: - runner networks: gitea_network: driver: '' external: true ``` ### Database MySQL/MariaDB
GiteaMirror added the issue/workaroundissue/not-a-bug labels 2025-11-02 11:06:13 -06:00
Author
Owner

@TheFox0x7 commented on GitHub (Feb 28, 2025):

Runner by default creates a network for it's containers which is separate from yours. To resolve this create runner config file as described here and set network to your custom one.

@TheFox0x7 commented on GitHub (Feb 28, 2025): Runner by default creates a network for it's containers which is separate from yours. To resolve this create runner config file [as described here](https://gitea.com/gitea/act_runner#configuration) and set [network to your custom one](https://gitea.com/gitea/act_runner/src/branch/main/internal/pkg/config/config.example.yaml#L63-L67).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14203