Running Postgres/MongoDB from inside docker with dind

Hi, all!

I want to run postgres and mongodb from docker builder. Here is my .gitlab-ci.yml:

    image: docker:latest

    variables:
      DOCKER_DRIVER: overlay2
      IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME

    services:
      - docker:dind

    before_script:
      - docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
    stages:
      - test

    run_test: 
      stage: test
      script:
        - docker pull $IMAGE_TAG
        - docker pull postgres
        - docker pull mongo
        - docker images
        - docker run -p 5432:5432 --name postgres -d postgres
        - docker run -p 27017:27017 --name mongo -d mongo
        - netstat -tlpn
        - docker ps
        - docker logs postgres
        - docker logs mongo
        - docker exec postgres ls
        - docker exec postgres ss -tlpn
        - docker exec postgres psql -U postgres -h localhost -c "CREATE USER tester WITH PASSWORD 'testbest'"    
        - docker exec postgres psql -U postgres -h localhost -c "CREATE DATABASE tester WITH OWNER tester"
        - docker run --link postgres:postgres $IMAGE_TAG ci

This does not work. Output from docker ps:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED                  STATUS                  PORTS                      NAMES
fc5e356f58b9        mongo               "docker-entrypoint.s…"   Less than a second ago   Up Less than a second   0.0.0.0:27017->27017/tcp   mongo
dbb27446f9bb        postgres            "docker-entrypoint.s…"   1 second ago             Up Less than a second   0.0.0.0:5432->5432/tcp     postgres

But inside the running postgres container server does not bind to the port:

$ docker exec postgres ss -tlpn
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
$ docker exec postgres psql -U postgres -h localhost -c "CREATE USER tester WITH PASSWORD 'testbest'"

What do I do wrong?