version: "2"

services:
  web:
    build: .
    volumes:
      - .:/app
    ports:
      - 3000:3000
    environment:
      - PGHOST=postgres
      - PGDATABASE=postgres
      - PGUSER=postgres
      - PGPASSWORD=postgres
      - COOKIE_SECRET=ourhardworkbythesewordsguarded
    links:
      - postgres:postgres
    depends_on:
      - postgres
  postgres:
    image: postgres:9.6
    volumes:
      - /var/lib/postgres/data
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

version: "2"

services:
  web:
    build: .
    volumes:
      - .:/app
    ports:
      - 3000:3000
    environment:
      - PGHOST=postgres
      - PGDATABASE=postgres
      - PGUSER=postgres
      - PGPASSWORD=postgres
      - COOKIE_SECRET=ourhardworkbythesewordsguarded
    links:
      - postgres:postgres
    depends_on:
      - postgres
  postgres:
    ports:
      - 5432:5432
    image: postgres:9.6
    volumes:
      - /var/lib/postgres/data
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres

Add port to postgres container
Add port to postgres container

(Should Work™)
