'Unable to connect to docker postgres with password
I am trying to connect to a locally running postgres on docker. I am running the basic tutorial initialization:
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
when I try: pgcli -h localhost -U postgres postgres I get password denied. I have also tried with pguser. I have also tried setting the username as well with the same result.
When I try with a generic database application, DBeaver, same result password denied.
I have tried going in to the running container and resetting the password as well: docker exec -it <hash> bash and then manually setting the password again to something simple.
Solution 1:[1]
I faintly remember postgresql to a) have a different password for a postgresql account than the one you have to set for the linux user account and b) having to activate logging in with a username and password somewhere in the config
Hope this helps, just something off the top of my head
Solution 2:[2]
I was getting a similar error with port 5432 (default) and I had a local postgres installation too, which is creating the problem. To avoid the two instances fighting for same port, two things can be done.
- Stop instance of local postgres
- In docker container postgres path, open postgresql.conf and change default port.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | biscuitrapist |
| Solution 2 | habibalsaki |
