Skip to content

runners, docker-compose and names resolving #33753

Open
@PantinEcarlate

Description

@PantinEcarlate

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/not-a-bugThe reported issue is the intended behavior or the problem is not inside Giteaissue/workaroundit is or has a workaround

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions