gistfile1.txt
· 203 B · Text
Raw
# BACKUP
docker exec -i <container-name> /bin/bash -c "PGPASSWORD=<passwd> pg_dump --username <user> <db-name>" > ~/db.sql
# RESTORE
cat your_dump.sql | docker exec -i your-db-container psql -U postgres
1 | # BACKUP |
2 | docker exec -i <container-name> /bin/bash -c "PGPASSWORD=<passwd> pg_dump --username <user> <db-name>" > ~/db.sql |
3 | |
4 | # RESTORE |
5 | cat your_dump.sql | docker exec -i your-db-container psql -U postgres |