-
-
Save kamwing/5a1d6331df0624999bbfec371d41a474 to your computer and use it in GitHub Desktop.
Backup a postgres db on Docker
This file contains hidden or 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 both tables and data | |
docker exec -t CONTAINER pg_dumpall -c -U USERNAME > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
# backup data only | |
docker exec -t api_postgres_1 pg_dumpall -c -U prisma -a > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
# apply backup | |
cat your_dump.sql | docker exec -i CONTAINER psql -U USERNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment