Unable to connect to services when using docker:latest and docker:dind

I have been trying to get this to work for a few hours, and I'm starting to think I might be doing something wrong! Currently, my gitlab-ci.yml looks like this:

image: docker:latest

services:
  - docker:dind
  - name: postgres:9.6
    alias: db-postgres
  - name: redis:latest
    alias: cache-redis
stages:
  - build
  - test

variables:
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: HvIRSoRN9EpMXBxNq7evWeXAr
  POSTGRES_DB: postgres
  CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  NODE_ENV: test
  trust_databasePassword: HvIRSoRN9EpMXBxNq7evWeXAr
  trust_databaseHost: db-postgres
  trust_redisHost: cache-redis

before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

build:
  stage: build
  script:
    - docker build --pull -t $CONTAINER_TEST_IMAGE .
    - docker push $CONTAINER_TEST_IMAGE

test:
  stage: test
  script:
    - docker pull $CONTAINER_TEST_IMAGE
    - docker run -e NODE_ENV=test -e trust_databasePassword=$trust_databasePassword -e trust_databaseHost=$trust_databaseHost -e trust_redisHost=$trust_redisHost $CONTAINER_TEST_IMAGE yarn run test

Unfortunately, the test stage fails (See it here: https://gitlab.com/v42/trust/trust-api/-/jobs/30123744) What I'm trying to achieve is have the postgres and redis services available inside the container that I'm running "yarn run test" inside.

What could I be doing wrong?

Edited by Tomasz Maczukin