Pretty simple to switch (if you have a little docker experience). Create a folder (e.g. ./postgres
), add the folder as a volume in the postgres portion of the compose file (maybe something like /db
), then run just the database with newly mounted folder, shell in, and copy everything from the Postgres folder to this new folder. After that, swap mounts so the new folder is used as Postgres db and you’re good. If something went wrong, the pgdata
volume is still there to switch back to.
The key for me was being told: it’s okay to ride (to hold) the clutch a little before/during/after you’re switching gears.