Skip to content

Instantly share code, notes, and snippets.

@xenups
Created October 4, 2020 08:42
Show Gist options
  • Save xenups/af9c33bff0c7de70f7e5f169c650ea04 to your computer and use it in GitHub Desktop.
Save xenups/af9c33bff0c7de70f7e5f169c650ea04 to your computer and use it in GitHub Desktop.
How to back up docker postgres
to create a backup
docker exec -t <container-id> pg_dumpall -c -U postgres_user > backup.sql
to restore it :
cat backup.sql | docker exec -i postgres psql -U postgres_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment