- make sure you mounted
/var/lib/postgresql/data/
as a volume
- to backup the database run this over docker exec replace tools_postgres_1 with the name of your postgres container
docker exec tools_postgres_1 bash -c "pg_dump --username=postgres --no-password --format=t db_name | gzip > /var/lib/postgresql/data/backup/backup_local_$(date +%Y-%m-%d).tar.gz"
- restore the database using portainer console
docker exec tools_postgres_1 bash -c "pg_restore --username=postgres --no-password --dbname=db_name --verbose /var/lib/postgresql/data/backup/backup_local_29-01-2017.tar.gz"
- to drop the old database use