Pipeline services fail to translate hostnames

I’m running multiple services for a test job in our merge requests on gitlab.com and I’m running into an issue when using multiple services that need to able to communicate with each other.

This is part of the definiton for the test job in the pipeline:

  stage: test
  image: maven:3.8.7
    - name: postgres
      alias: postgres-container
        POSTGRES_DB: testdatabase
        POSTGRES_USER: admin
        POSTGRES_PASSWORD: password
    - name: mockserver/mockserver:latest
      alias: mockserver
    - name: redis:latest
      alias: redis
    - name: [...]/camunda-liquibase-update:latest
      alias: camunda-init
        USERNAME: admin
        PASSWORD: password
        URL: jdbc:postgresql://postgres-container:5432/testdatabase
[...] # script part removed for brevity

The service postgres-container runs fine and can be used in the script part of the job to host our database, but I need to run a script from the camunda-init service. This is a custom docker-image that initializes a part of our database and runs that script as its CMD in the dockerfile.

The problem is that the gitlab.com runner fails to resolve the hostname postgres-container inside the camunda-init service, here are the relevant parts of the logs from running the test job:

Health check container logs:
2023-12-04T15:21:15.259281477Z FATAL: No HOST or PORT found                      
Service container logs:
2023-12-04T15:21:12.433330439Z psql: error: could not translate host name "postgres-container" to address: Name or service not known
2023-12-04T15:21:12.503972742Z psql: error: could not translate host name "postgres-container" to address: Name or service not known

I need the camunda-init script to run before the other script portion of the test job runs. The camunda-init docker image contains multiple files and dependencies that would clutter up the test job and I’m trying to keep things as modular as possible because I’m also using the camunda-init container during our deployment phase.

Am I simply missing some configuration in our pipeline or is this not possible to do? As an alternative I also thought about calling the camunda-init script from the script part of the test job, but I couldn’t find a description in the documentation.


Edit: All of this runs inside a private group so I can’t share the jobs directly.