docker

Posted by 云起 on 2022-11-02
Estimated Reading Time 1 Minutes
Words 159 In Total
Viewed Times

docker修改镜像存储位置

利用wsl进行修改

1
wsl --list -v

![wsl list](wsl list.png)

docker-desktop-data导出到文件中(备份image及相关文件),使用如下命令

1
wsl --export docker-desktop-data "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 !