I have this really simple setup with a web app in one container and a Postgres service running in another container.
I need to connect to the Postgres container and thought PGHOST="db" would point to that container ..?
But I keep getting Error: getaddrinfo ENOTFOUND "db" at GetAddrInfoReqWrap.onlookup that I read as; can't find the "db" host ...
What am I missing here?
version: "3.9"
services:
  web:
    build: .
    ports:
      - "8081:3011"
    links:
      - db
    environment:
      - PGHOST="db"
      - PGDATABASE="testdb"
      - PGUSER="postgres"
      - PGPASSWORD="postgres"
  db:
    image: postgres
    ports:
      - "5432:5432"
    volumes:
      - /usr/local/var/postgresql@13
 
    