Postgresql :invalid length of startup packet

I’m working on an exercise that asks to create a compose file including custom Drupal image and postgres image for a Drupal content management system website.

I created a custom Drupal image using Dockerfile including only (FROM drupal:latest EXPOSE 80) to add it with a postgres in a compose file with postgres image, then run docker-compose up everything is building.

When i try to access the postgres on web browser I get : The page isn’t working. And on the terminal : postgress LOG: invalid length of startup packet .

And when I go to log on drupal website using also the web browser I get :

Error message

Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.

  • Failed to connect to your database server. The server reports the following message: SQLSTATE[08006] [7] FATAL: password authentication failed for user “postgres”.
    • Is the database server running?
    • Does the database exist, and have you entered the correct database name?
    • Have you entered the correct username and password?
    • Have you entered the correct database hostname and port number?

I hope you can help me solve this problem. Thanks in advance.

Please share the content of your compose file.

Access how?

We need to know what you exactly do, in order to advise on what needs to be done differently.

localhost:5432

Thanks. I’m totally new to docker, I’m trying my best.

This part of the documentation should give you an insight what needs to be done differently:
Differences between user-defined bridges and the default bridge