Last active
March 5, 2018 16:14
-
-
Save evenfrost/856acc7045cd5d3db6fb46763abe2b83 to your computer and use it in GitHub Desktop.
Backup and restore Posgtres from/to Docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# backup from Docker container | |
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
# restore to Docker container | |
cat dump.sql | docker exec -i postgres-container-id psql -U postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment