Skip to content

Instantly share code, notes, and snippets.

@BartlomiejSkwira
Last active April 3, 2018 14:42
Show Gist options
  • Save BartlomiejSkwira/0a9912e92c34c0a8ac49df45cb1f2e0c to your computer and use it in GitHub Desktop.
Save BartlomiejSkwira/0a9912e92c34c0a8ac49df45cb1f2e0c to your computer and use it in GitHub Desktop.
Backup and restore postgres in Docker
#Backup your databases
docker exec -u <your_postgres_user> <postgres_container_name> pg_dump -Fc <db_name> > db.dump
#Restore your databases
docker exec -i -u <your_postgres_user> <postgres_container_name> pg_restore -C -d <db_name> < db.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment