Created
March 13, 2019 16:56
-
-
Save jeroneemou/1816a9a63b85ed05fdb1e809555f14cb to your computer and use it in GitHub Desktop.
Backup and restore mysql docker container which has mounted volume for data
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
| # Backup container of mysql | |
| docker run --rm --volumes-from my-mysql-container -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /var/lib/mysql | |
| # Restore container of mysql | |
| docker run --rm --volumes-from my-mysql-container -v $(pwd):/backup ubuntu bash -c "cd /var && tar xvf /backup/backup.tar --strip 1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment