Docker containers run via docker-compose are not by default accessible to each other using “localhost” hostname, to reach a container from another container you need to use a hostname that is the same as container name. So you need to configure your database like this.
username: "postgres",
password: "postgres",
database: "milk_dev",
hostname: "postgres",
Might be you also need to remove “hostname: localhost” from PostgreSQL service configuration.


















