I have the below docker-compose.yaml:
version: "3.9"
services:
  server:
    depends_on:
      - db
    build:
      context: .
    container_name: grpc-server
    hostname: grpc-server
    networks:
      - mynet
    ports:
      - 8080:8080
    deploy:
      restart_policy:
        condition: on-failure
  db:
    image: postgres
    container_name: postgres-db
    hostname: postgres
    networks:
      - mynet
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - 5432:5432
networks:
  mynet:
    driver: bridge
However my server container logs are indicating it can't connect to the db.
[error] failed to initialize database, got error dial tcp 127.0.0.1:5432: connect: connection refused
I'm assuming I need to inject the db path into the server somehow via the mynet?