I’m trying to set up a service container in my gitea action, but it doesn’t seem to be visible to the container running the actual build – neither using the label as hostname, nor trying to connect via localhost (I’m not sure about docker network setup that gitea uses). Unfortunately, there seems to be little to no information on what exactly is supported within gitea actions.
This is my testbed:
name: Build Project
on: [push]
jobs:
TestWithDb:
runs-on: ubuntu-latest
services:
db:
image: mariadb:11.4.2-ubi9
ports:
- 3306:3306
environment:
MARIADB_DATABASE: "test"
MARIADB_USER: "test"
MARIADB_PASSWORD: "test"
MARIADB_ROOT_PASSWORD: "test"
MARIADB_MYSQL_LOCALHOST_GRANTS: "test"
steps:
- name: install netcat
run: apt-get -y update ; apt -y install netcat-openbsd
- name: try to connect to db
run: nc -w5 -z -v db 3306 || nc -w5 -z -v localhost 3306
In the second build step, netcat fails with:
nc: getaddrinfo for host "db" port 3306: Temporary failure in name resolution
nc: connect to localhost (127.0.0.1) port 3306 (tcp) failed: Connection refused
nc: connect to localhost (::1) port 3306 (tcp) failed: Cannot assign requested address
I’m self-hosting gitea, with a runner running on the same machine (not in a container).
UPDATE: I just discovered that the db container is not even started (thus renaming the topic this question). Also, docker inspect
shows that there are no links configured between service and build container. Still no clue why that is.