0
Follow
0
View

Trying to back up a volume from Docker via PowerShell - .tar file is nowhere to be seen

yinfeng201 注册会员
2023-01-25 04:39

Your tar file is created in the work directory in the container. When the container stops, the container is removed and the file is lost. You need to specify that the file should be created in the /backup directory like this

docker run --rm --volumes-from wordpress_db_1 -v c:\:/backup ubuntu tar cvf /backup/backup.tar /var/lib/mysql

One thing to note is that by mapping the root of your C drive, you give the container full access to the whole disk. So be careful :) It would be safer to map the %temp% or another directory like this

docker run --rm --volumes-from wordpress_db_1 -v %temp%:/backup ubuntu tar cvf /backup/backup.tar /var/lib/mysql

About the Author

Question Info

Publish Time
2023-01-25 04:39
Update Time
2023-01-25 04:39