Skip to content

Instantly share code, notes, and snippets.

@gilyes
Last active March 23, 2024 09:30
Show Gist options
  • Save gilyes/525cc0f471aafae18c3857c27519fc4b to your computer and use it in GitHub Desktop.
Save gilyes/525cc0f471aafae18c3857c27519fc4b to your computer and use it in GitHub Desktop.
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@zkenstein
Copy link

cat your_dump.sql | docker exec -i {docker-postgres-container} psql -U {user} -d {database_name} try this but got Internal server error while access the query page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment