From e97022fb020f640f7c36d35c27d71b3a3a74ceac Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 26 Jul 2022 13:19:17 +0200 Subject: [PATCH] add documentation to backup+restore the database from PostgreSQL docker container --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 8ff1af54..227a0eb6 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,16 @@ Remove the PostgreSQL container: After the PostgreSQL container is removed, you need to create it again as shown in "Create and run ..." above. +Given the container is running, to create a backup in ~/backup, run: + + docker exec -i hsadmin-ng-postgres /usr/bin/pg_dump --clean --create -U postgres postgres | gzip -9 > ~/backup/hsadmin-ng-postgres2.sql.gz + + +Again, given the container is running, to restore the backup from ~/backup, run: + + gunzip --stdout --keep ~/backup/hsadmin-ng-postgres.sql.gz | docker exec -i hsadmin-ng-postgres psql -U postgres -d postgres + + ### Markdown with PlantUML plugin Can you see the following diagram?