Name resolution of alias stops working after a while

I am on a self hosted gitlab (v16.1)

I have a project where I run my build scripts on windows container runtime. For the test stage I use a service (mysql). This works pretty well but after a while (one or two weeks) my test fail because of

ERROR 2005 (HY000): Unknown MySQL server host 'db' (2)

I connected to a running build container. Running ping db fails but ping works.

if I run the commands

docker run -it --name db registry.company.tld/company/build-images/db-image:latest
docker run -it --name app --link db:db registry.company.tld/company/build-images/build-image:latest

and run ping db inside the app container works. So I assume the problem is with gitlab failing to link the containers properly.

Restarting docker service does not help.
Restarting gitlab-runner service does not help.
Restarting windows solves the issue for a week or two.

The build server is running windows server 2019 with feature containers enabled.
Windows, GitLab and GitLab runner are on current versions.

Any suggestions on how to fix or debug this?


This is my build script

test:
  stage: test
  tags:
    - windows
    - docker
  services:
    - name: registry.company.tld/company/build-images/db-image:latest
      alias: db
  variables:
    FF_NETWORK_PER_BUILD: 1
  scripts:
    - ping db

and this is my runner config

[[runners]]
  name = "server-docker-windows"
  url = "https://git.company.tld"
  id = 16
  token = "..."
  token_obtained_at = 2023-03-10T13:31:55Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker-windows"
  shell = "powershell"
  [runners.feature_flags]
    "FF_USE_FASTZIP" = true
  [runners.docker]
    tls_verify = false
    image = "registry.company.tld/company/build-images/build-image:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["c:\\cache"]
    shm_size = 0