Last active
August 5, 2021 12:17
-
-
Save kkkasio/9ce5d6f704c246af0504b3970ab1611e to your computer and use it in GitHub Desktop.
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 specifc database | |
docker exec -i database pg_dump --u postgres DATABASE_NAME_HERE > DUMP_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
Backup all databases | |
docker exec -t -u postgres CONTAINER_NAME_HERE pg_dumpall -c > DUMP_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
to restore: | |
cat YOUR_FILE.sql | docker exec -i CONTAINER_NAME_HERE psql -U USER_NAME_HERE -d DATABASE_NAME_HERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment