docker-postgresql icon indicating copy to clipboard operation
docker-postgresql copied to clipboard

Create ~/.pgpass file

Open Downchuck opened this issue 9 years ago • 3 comments

It would be helpful to create a /root/.pgpass file when DB_USER= DB_PASS are set in the run command, as the postgresql conf is set to md5 and peer, and the DB_USER may not exist as a user within the system.

As a side-note, I was thrown off between:

  • /var/lib/postgresql/9.4/main/pg_hba.conf and
  • /etc/postgresql/9.4/main/pg_hba.conf

Downchuck avatar Mar 13 '15 22:03 Downchuck

Yes this would be really nice. It is the only way I found to be able to create database dumps from the host with docker exec ....

kain88-de avatar Mar 26 '15 12:03 kain88-de

I don't fully understand this use case. Can you please provide some details.

As for now, the image has the PG_TRUST_LOCALNET option which should allow you to login without a password. For backups a new replication mode us made available to backup the entire cluster https://github.com/sameersbn/docker-postgresql#creating-a-backup.

Please note: at the moment this backup feature is only available in the latest tag.

sameersbn avatar Nov 28 '15 06:11 sameersbn

docker exec -i container-id sudo -u postgres -- pg_dump "$@"

works great to me.

b-a-t avatar Feb 03 '17 13:02 b-a-t