CI job and container hostname resolve issue

ng e2e tests        :
    variables         :
      DATABASE_HOST   : postgresql
      POSTGRES_HOST_AUTH_METHOD : trust
      RAILS_ENV       : development
    image             : trion/ng-cli-e2e:latest
    services          : 
                      - name : $CI_REGISTRY/audi/custom-postgres
                        alias: postgresql
                      - name : $CI_REGISTRY/audi/core-service
                        alias: core-service
    stage             : test
    tags              :
                      - audi
    before_script     :
                      - cat /etc/hosts
    script            :
                      - npm install
                      - npm run e2e-ci

output from the cat /etc/hosts command

              127.0.0.1	localhost
              ::1	localhost ip6-localhost ip6-loopback
              fe00::0	ip6-localnet
              ff00::0	ip6-mcastprefix
              ff02::1	ip6-allnodes
              ff02::2	ip6-allrouters
              172.17.0.4	gitlab.devsoft.dk-audi-core-service e1631bb255ec runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__core-service-1
              172.17.0.4	core-service e1631bb255ec runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__core-service-1
              172.17.0.3	gitlab.devsoft.dk__audi__custom-postgres d2d08b04c2d4 runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__custom-postgres-0
              172.17.0.3	gitlab.devsoft.dk-audi-custom-postgres d2d08b04c2d4 runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__custom-postgres-0
              172.17.0.3	postgresql d2d08b04c2d4 runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__custom-postgres-0
              172.17.0.4	gitlab.devsoft.dk__audi__core-service e1631bb255ec runner-62C79frd-project-531-concurrent-0-gitlab.devsoft.dk__audi__core-service-1
              172.17.0.5	runner-62C79frd-project-531-concurrent-0

core-service is a Ruby rest service in docker. postgresql is a postgresql database with initialization scripts. I have set the network_mode to bride so that it resolves names. I am using dind executor.
When the job is run however I get an error

PG::ConnectionBad: could not translate host name \"postgresql\" to address: Name does not resolve

detailed report (shortened)

- Expected [ Entry({ level: SEVERE, message: 'http://localhost:4300/api/v1/contracts?page%5Boffset%5D=0&page%5Blimit%5D=20&sort%5Bid%5D=desc -

Failed to load resource: the server responded with a status of 500 (Internal Server Error)', timestamp: 1583409684432, type: '' }),

Entry({ level: SEVERE, message: 'http://localhost:4300/vendor.js 43426:40

"ERROR" Error: Uncaught (in promise): HttpErrorResponse: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":500,

"statusText":"Internal Server Error","url":"http://localhost:4300/api/v1/contracts?page%5Boffset%5D=0&page%5Blimit%5D=20&sort%5Bid%5D=desc","ok":false,

"name":"HttpErrorResponse","message":"Http failure response for http://localhost:4300/api/v1/contracts?page%5Boffset%5D=0&page%5Blimit%5D=20&sort%5Bid%5D=desc: 500 Internal Server Error",

"error":{"status":500,"error":"Internal Server Error","exception":"#<PG::ConnectionBad: could not translate host name \"postgresql\" to address: Name does not resolve\n>",

"traces":{"Application Trace":[],"Framework Trace":[{"exception_object_id":47356902028080,"id":0,"trace":"pg (1.2.2) lib/pg.rb:58:in `initialize'"},{"exception_object_id":47356902028080,"id":1,"trace":"pg (1.2.2) lib/pg.rb:58:in `new'"},{"exception_object_id":47356902028080,"id":2,"trace":"pg (1.2.2)

lib/pg.rb:58:in `connect'"},{"exception_object_id":47356902028080,"id":3,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/postgresql_adapter.rb:46:in `postgresql_connection'"},

{"exception_object_id":47356902028080,"id":4,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:889:in `new_connection'"},

{"exception_object_id":47356902028080,"id":5,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:933:in `checkout_new_connection'"},

{"exception_object_id":47356902028080,"id":6,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:912:in `try_to_checkout_new_connection'"},

{"exception_object_id":47356902028080,"id":7,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:873:in `acquire_connection'"},

{"exception_object_id":47356902028080,"id":8,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:595:in `checkout'"},

{"exception_object_id":47356902028080,"id":9,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:439:in `connection'"},

{"exception_object_id":47356902028080,"id":10,"trace":"activerecord (6.0.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:...

I have double checked everything… I even checked the recent breaking change with the postgresql in container. I can see all the containers are running and have the correct hostname, but for some reason the service cannot resolve the postgresql hostname on the database container. Can someone tell me how to debug further or what is possibly going wrong ?