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
docker run -it --name app --link db:db

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

  stage: test
    - windows
    - docker
    - name:
      alias: db
    - ping db

and this is my runner config

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