Skip to content
piccaso edited this page May 4, 2022 · 4 revisions

Related Notes

Backup and Restore of postgres containers with docker compose

Backup complete database

docker-compose exec db pg_dumpall -U postgres --clean --if-exists > dump.sql

Restore into empty instance

make sure instance is empty. remove volumes before restart maybe like so: docker-compose down -v

cat dump.sql | docker-compose exec -T db psql -U postgres

dev setup

docker run -p 5432:5432 --name pg-dev --restart unless-stopped -e POSTGRES_PASSWORD=1234 -d postgres:alpine postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF -c log_statement=all -c log_destination=stderr