Skip to content

Instantly share code, notes, and snippets.

@goooooouwa
Last active December 9, 2023 01:44
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 goooooouwa/32f7db069b74cd495054f411f3247b71 to your computer and use it in GitHub Desktop.
Save goooooouwa/32f7db069b74cd495054f411f3247b71 to your computer and use it in GitHub Desktop.
how to backup & restore a pg dump in postgres docker container
sudo docker exec -t e564422f1f57 pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
# ref: https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database
cat latest.dump | sudo docker exec -i e564422f1f57 psql -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment