Skip to content

Add .pgpass file for non-interactive db dump possibility

Remo Wenger requested to merge 9.3-4 into 9.3

If you want to dump your database non-interactively, you have to run "pg_dump". Unfortunately, pg_dump doesn't allow to pass a password. A solution is to save your password in ~/.pgpass.

You could install pg_dump on the docker host and create .pgpass aswell, but there's chance of version incompatibility between client and server.

My solution is to provide the .pgpass file in the container itself and running this command outside of the container:

docker exec postgresql pg_dump -h localhost -U username dbname

It would be nice if you could implement these two lines in all your branches.

Merge request reports