diff options
author | breadcat | 2023-02-14 22:58:35 +0000 |
---|---|---|
committer | breadcat | 2023-02-14 22:58:35 +0000 |
commit | 047e82680759223dd056f24af9a2af63d1ce7fa6 (patch) | |
tree | ab767168f587a880858af10d9140f3dff88e0d29 /content | |
parent | 8b9456d8f9388f53a47a1af87bb8dedc4fe7fd8b (diff) | |
download | blog.minskio.co.uk-047e82680759223dd056f24af9a2af63d1ce7fa6.tar.gz blog.minskio.co.uk-047e82680759223dd056f24af9a2af63d1ce7fa6.tar.bz2 blog.minskio.co.uk-047e82680759223dd056f24af9a2af63d1ce7fa6.zip |
Update restoration instructions
Diffstat (limited to 'content')
-rw-r--r-- | content/posts/upgrading-postgresql-docker-containers.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/content/posts/upgrading-postgresql-docker-containers.md b/content/posts/upgrading-postgresql-docker-containers.md index 690d083..fd8a459 100644 --- a/content/posts/upgrading-postgresql-docker-containers.md +++ b/content/posts/upgrading-postgresql-docker-containers.md @@ -1,6 +1,7 @@ --- title: "Upgrading PostgreSQL in an Alpine docker container" date: 2021-10-18T17:16:00 +lastmod: 2023-02-14T22:37:00 tags: ["Databases", "Docker", "Guides", "Linux", "Servers", "Software"] --- @@ -34,10 +35,11 @@ Now we can check if the container is running and ready to accept connections: docker logs -f postgres ``` -If all looks good, move your `postgres-dump.sql` to your mounted volume using `sudo mv postgres-dump.sql postgres/`. With this backup now accessible in our container, access it and import the backup into the live database: +If all looks good, we'll copy over the `postgres-dump.sql` file to the container, and restore it: ``` -docker exec -it postgres -psql -U postgres < /var/lib/postgresql/data/postgres-dump.sql +docker cp postgres-dump.sql postgres:/ +docker exec -it postgres sh +psql -U postgres < /postgres-dump.sql ``` Now exit from the container and restart the container, then watch the logs to ensure everything comes up as expected: @@ -47,4 +49,6 @@ docker restart postgres docker logs -f postgres ``` -All being well, everything will have gone well and you can bookmark this guide for the next major upgrade.
\ No newline at end of file +All being well, everything will have gone well and you can bookmark this guide for the next major upgrade. + +* **Edit 2023-02-14:** Streamlined restoration instructions
\ No newline at end of file |