Migrating from one Docker Compose host to another

I sorted out the issue. My fault—something I should have seen. When restoring the volumes, I was inconsistent with the tar --strip parameter and the Mongo volume restored to the wrong directory. For example, this:

docker run --rm --volumes-from 557b6b76b532 -v $(pwd):/backup busybox sh -c "cd /data/db && tar xvf /backup/mongodb-data.tar --strip 1"

…is incorrect because it will extract to /data/db/db/ in the container. Since the volume is mounted two directories deep, I needed to revise to --strip 2.

And of course the other volume container paths should be double-checked accordingly when restoring to the new host:

docker run --rm --volumes-from de0f9b910c7f -v $(pwd):/backup busybox sh -c "cd /usr/share/graylog/data/data && tar xvf /backup/graylog-data.tar --strip 5"

docker run --rm --volumes-from de0f9b910c7f -v $(pwd):/backup busybox sh -c "cd /usr/share/graylog/data/journal && tar xvf /backup/graylog-journal.tar --strip 5"

docker run --rm --volumes-from 811ff5580d0f -v $(pwd):/backup busybox sh -c "cd /var/lib/graylog-datanode && tar xvf /backup/graylog-datanode.tar --strip 3"
1 Like