Skip to content

Instantly share code, notes, and snippets.

@johananl
Created March 12, 2020 17:52
Show Gist options
  • Save johananl/d4bacbdd1d675ea83c93e773861c8d12 to your computer and use it in GitHub Desktop.
Save johananl/d4bacbdd1d675ea83c93e773861c8d12 to your computer and use it in GitHub Desktop.
Backup/restore Postgres in Docker
docker exec postgres.service pg_dump -U my_user my_db > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
docker exec -i postgres.service psql -U my_user my_db < dump_12-03-2020_17_49_37.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment