Skip to content

Instantly share code, notes, and snippets.

@ZeroCoolHacker
Last active January 20, 2024 19:44
Show Gist options
  • Save ZeroCoolHacker/8ab7545543fc05fc3af81a94a53d10b9 to your computer and use it in GitHub Desktop.
Save ZeroCoolHacker/8ab7545543fc05fc3af81a94a53d10b9 to your computer and use it in GitHub Desktop.
Backup and restore or clone a postgres database using docker
# Backup Postgres Database
```docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql```
# Restore Postgres Database
```cat your_dump.sql | docker exec -i your-db-container psql -U postgres```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment