I know the container is successfully running on port 5432:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a553b2135fcf postgres:alpine "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres
Envs are used by postgres initdb to create your postgresql instance. If you changed yours envs after first execution, you need to delete the postgres container to force a recreation using new envs. If you have defined a volume, you will also need to remove it.
Hi, I am going through the same situation, from the container I can enter without problems, but when I do a get from my api it gives me that error. How did you fix it?
it will work if you change the local port attached to docker port
something like 1234:5432
i think its because postgressql is installed in the system and its listening to teh port 5432 and the port in docker is colliding with it.
remove postgres from the system
If you run the container once with a different password and then restart it with another password, it won’t update the existing database because it’s already initialized. Try removing the old volumes or using a different volume.