I’ve been trying to accomplish migrating a volume from one container to the same container on a different host, just by testing out the method in the Docker docs: Restore Volume from Backup. However, the project I am working on starts the container using docker-compose
instead of docker run
. Anyone know if I can change the .yaml file somehow to decompress a tarball (similar to the docker run method)?
The docker run
command for restoring from a backup looks like this:
docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c "cd /dbdata && tar xvf /backup/backup.tar --strip 1"
2
Answers
So, I followed the docs linked in my question. The reason it wasn't working originally is because I needed to double check that the original volume AND container were removed before mounting the backup volume.
Essentially,
If you can decompress the tarball file you can use this in your docker-compose.yaml file