Adapted from https://github.com/docker-library/postgres/.
Should work as the official Postgres image.
Run docker exec db_name /usr/local/bin/backup create a db dump with pg_dumpall in $BACKUPROOT (defaults to /var/lib/postgresql/backup). The script will gzip the dump and keep the ten latest runs.
Restore a pg_dumpall database dump by mounting it to /restore/dump_all.sql. The restore script will only run if the database is uninitialized and the file dump_all.sql exists.