Skip to content

Instantly share code, notes, and snippets.

@evenfrost
Last active March 5, 2018 16:14
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 evenfrost/856acc7045cd5d3db6fb46763abe2b83 to your computer and use it in GitHub Desktop.
Save evenfrost/856acc7045cd5d3db6fb46763abe2b83 to your computer and use it in GitHub Desktop.
Backup and restore Posgtres from/to Docker container
# 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