Postgres Docker Container Migration Cheat Sheet

I just finished migrating a postgres database to a new host. To remember how to do it next time, I’m writing down the commands I used here.

I usually just shut down the database and then copy the local directory where the volume was mounted onto the new host. This time though, I seemed to be getting some I/O errors, so I had to do it the “right” way.

To be fair, this note is based on this guide. I modified it to fit my workflow with docker.