3 ms·
If you're running Postgres in Docker, you can just stop the container and tar up the data volume and start it somewhere else (This also works without Docker of
by ReactiveJelly 4y ago
If you're running Postgres in Docker, you can just stop the container and tar up the data volume and start it somewhere else
(This also works without Docker of course, but Docker makes me feel safer when I do stuff like this)
- latch 4y agoThis procedure is officially documented (1). Since we're talking about copying a folder, I'm not sure why you'd feel safer doing it via an additional layer of abstraction. (1) https://www.postgresql.org/docs/14/backup-file.html https://www.postgresql.org/docs/14/backup-file.html
- deleted 4y ago[deleted]
- bombela 4y agoWhy does Docker makes you feel safer here? Is it because you feel more confident there is no database process still running?
- ravi-delia 4y agoIf you're an ignorant fool such as myself, your knowledge of a database's internals is sufficient only to inspire fear. With Docker I know that whatever black magic the database uses is contained within a black box I can copy wholesale. Anything important must be in there, since I didn't give it anything else!
- ReactiveJelly 4y agoIt's more about, I don't like having a global directory namespace that everything gets dumped into. I know that PG data is usually in /var/lib/postgresql/data, but I like Docker because if I ever need a 2nd or 3rd database on one system, I can give them more meaningful names and not feel like I'm touching Important System-Wide Stuff.
- hda111 4y agoDoes this work even when the Postgres is updated to a newer version? This would make me want to use docker as well.
- ReactiveJelly 4y agoI'd have to read the Postgres docs to be sure. Postgres has really good docs. My intuition is that you're expected to do some kind of migration or export/import, because the on-disk format probably changes between major versions.