One of the postgres containers stops as soon as it starts

I’m currently working in a big app wich has a parent forlder with the docker.compose files calling other docker-compose files in sub folders which are the different modules of the app.
Everithing works everywhere but in my mac i started having an issue trying to intsall everything. One of the containers is exiting as soon it starts when i run docker-compose up -d in the parent folder. They are 9 containers but only 8 remain running. The one stopping is one of the postgres containers.
It’s not the code, since it works in other computers including my laptop at work and i cannot modify it since it propably would affect the rest of the team, and by the way this wasn’t happening in my mac, it started now.
Any Idea where to begin?

1 Like

It is difficult to have ideas if we don’t have more detailed information about how you create this container. A good point to start is the log of the exited container. If you use the Postgres image from Dockerhub you can read it with:

docker container logs CONTAINER_ID

(type the first 4 or 5 characters of the ID)

Have you anywhere specified the m/m limitation? I had the similar issue when i used to run oracle database.

I am new to docker, your comment saved me lots of trouble. In my case, I had to insert “-e POSTGRES_HOST_AUTH_METHOD=trust” option in “docker run” command. (I am just testing the sample-voting-app), so I guess security is not a concern for me at this time. But your comment solved my issue. Thanks.

1 Like

docker logs … worked thanks

type ❯ docker logs 61eafc53e4cf
Error: Database is uninitialized and superuser password is not specified.
       You must specify POSTGRES_PASSWORD for the superuser. Use
       "-e POSTGRES_PASSWORD=password" to set it in "docker run".or paste code here
You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
       without a password. This is *not* recommended. See PostgreSQL
       documentation about "trust":