Last active
April 6, 2018 14:26
-
-
Save andrius/4547325eb4c025e882bad67a73b4a268 to your computer and use it in GitHub Desktop.
#howto #backup and restore #docker volumes (https://loomchild.net/2017/03/26/backup-restore-docker-named-volumes/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker volume name databases_mysql | |
docker run -ti --rm \ | |
-v databases_mysql:/volume \ | |
-v ${PWD}:/backup alpine \ | |
tar -cjf /backup/databases_mysql.tar.bz2 -C /volume ./ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scp databases_mysql.tar.bz2 to the server | |
# docker volume create databases_mysql | |
docker run -ti --rm \ | |
-v databases_mysql:/volume \ | |
-v ${PWD}:/backup alpine \ | |
sh -c "rm -rf /volume/* /volume/..?* /volume/.[!.]* ; tar -C /volume/ -xjf /backup/databases_mysql.tar.bz2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -ti --rm -v databases_mysql:/volume alpine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment