docker修改镜像存储位置
利用wsl进行修改
1 | wsl --list -v |
![wsl list](wsl list.png)
将docker-desktop-data
导出到文件中(备份image及相关文件),使用如下命令
1 | wsl -- docker-desktop- "D:\\docker-desktop-data.tar" |
从wsl取消注册
docker-desktop-data,请注意C:\Users\加菲晴\AppData\Local\Docker\wsl\data\ext4.vhdx
文件将被自动删除。
将导出的docker-desktop-data
再导入回wsl,并设置我们想要的路径,即新的镜像及各种docker使用的文件的挂载目录
1 | wsl --import docker-desktop-data "E:\\work\\docker" "D:\\docker-desktop-data.tar" --version 2 |
完成后,重启docker即可完成。
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !