Closed behnsen closed 4 years ago
I can't reproduce
[Postgres 2] -> [Host:5432] -> [Postgres 1]
$ docker volume create financial-data
financial-data
$ docker run --name some-postgres -v financial-data:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
0ad7d3b80b36ff57683f153f5d79e6eba4c851ea41f24fb54515e4a86dea0ecf
$ docker run -it --rm postgres psql -h 172.17.0.1 -U postgres
Password for user postgres:
psql (12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.
postgres=# SELECT rolname, rolpassword from pg_authid;
rolname | rolpassword
---------------------------+-------------------------------------
pg_monitor |
pg_read_all_settings |
pg_read_all_stats |
pg_stat_scan_tables |
pg_read_server_files |
pg_write_server_files |
pg_execute_server_program |
pg_signal_backend |
postgres | md5f669773c3bc40401c00685cf2f9c4ca2
(9 rows)
Thanks. Maybe there was something broken in my volume. Because you created the volume explicitly and not on the run like I am, I removed the old image and created it new. Now, everything works fine. Sorry for not checking consistency of the volume before. Can be closed.
Hello, today I simply tried to setup the easy example from postgres on docker hub:
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
For my purposes I added a publish and a volume flag:
docker run --name some-postgres -v financial-data:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
With the usage of the volume name
financial-data
, the container is running normally, but the connection to postgres withpsql -h 127.0.0.1 -U postgres
from Host failes:Password for user postgres:
psql: error: could not connect to server: FATAL: password authentication failed for user "postgres"
I played around with different parameters, but the problem fits exactly this name. For the volume names
financialdata
,financial_data
,test-data
everything works like expected:Password for user postgres:
psql (12.2 (Ubuntu 12.2-4), server 12.3 (Debian 12.3-1.pgdg100+1))
Type "help" for help.`postgres=# \q
I investigated the container a little bit more with
docker exec -it some-postgres bash
and found the problem in the hash for the userpostgres
in the database. For all volume names I get the following table:postgres=# SELECT rolname, rolpassword from pg_authid;
Only for the volume name
financial-data
the hash is different:postgres=# SELECT rolname, rolpassword from pg_authid;
Additional informations:
docker version: 19.03.8, build afacb8b7f0 postgres version: 12.3 (Debian 12.3-1.pgdg100+1) host: Ubuntu 20.04
Can anyone confirm this issue?