blob: b7bc5c06762ea970ec76b55c429f486c248d7162 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# Docker Volume Backup
Identify volume:
$ docker inspect my_container_name | grep -C 1 -i Source
Backup the directory to a tar file:
$ docker run –rm –volumes-from my_container_name -v $(pwd):/backup ubuntu tar cvf /backup/backup_db.tar /var/lib/mysql
Restore the volume:
$ docker run –rm –volumes-from my_container_name -v $(pwd):/backup ubuntu bash -c "cd /var/lib/mysql && tar xvf /backup/backup_db.tar –strip 1"
|