Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save othercodes/2d6abd6495e3a1188afb3a0b9ae45414 to your computer and use it in GitHub Desktop.
Save othercodes/2d6abd6495e3a1188afb3a0b9ae45414 to your computer and use it in GitHub Desktop.
Backup/restore postgres in docker container
# Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
# Restore:
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