Postgres container error connection refused

version: '2.1'
services:
  server:
    build: .
    command: npm run docker:setup-run
    volumes:
      - .:/usr/app/
      - /usr/app/node_modules
    ports:
      - "8081:8081"
    depends_on:
      db:
        condition: service_healthy
    environment:
      DATABASE_URL: postgresql://docker@db:5432/docker_db
      NODE_ENV: development
  test:
    build: .
    command: npm run docker:setup-tests
    volumes:
      - .:/usr/app/
      - .:/usr/__tests__
      - /usr/app/node_modules
    depends_on:
      db:
        condition: service_healthy
    environment:
      DATABASE_URL: postgresql://docker@db:5432/docker_db
      NODE_ENV: test
  db:
    image: postgres:9.6.2-alpine
    ports:
      - "5400:5484"
    environment:
      POSTGRES_USER: docker
      POSTGRES_DB: docker_db
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 30s
      retries: 3

Whenever I try to run docker-compose up server I get ERROR: connect ECONNREFUSED 127.0.0.1:32769. It’s trying to connect on the local host port instead of db’s port.