[Tool] Data Migration from archive to Docker volume

The motivation is the migration from native applications to docker container. Because of this, I’ve involved a lot of data migration from non-docker, like configuration home of jenkins in /var/lib/jenkins, to docker volume

Most steps I use are archiving the non-docker file first into *.tar.gz or *.tgz, and then mount the archive to some lightweight-image container like alpine or busybox to extract the file into the volume manually.

This repetition encourage me to create a docker image call ‘archive2volume’ (github, docker hub) just for automation of those tasks

1. First pull the Docker image

$ docker image pull busthehero/archive2volume

2. Run the image against volume you want archive file to be extracted upon

$ docker container run --rm \ 
-v archive:/tarfile/file.tgz \
-v volume:/volume \

The archive file must be mounted into this directory /tarfile . You can also mount the directory too, but the only the first file found in this directory is chosen

The volume, whether named or not, must be mounted into /volume for the container to extract the archive file upon