大网数据广告活动
服务器运维问答

How to move docker images to other drive in windows

· 52CE 我爱测

I try to run the following script but dockerd is not recognized in my workstation. My OS is windows 10. Just installed the latest version of docker that is 18.09.2 It is my first time with docker.

问题原文

原帖链接 · Miguel · CC BY-SA 4.0

I try to run the following script but dockerd is not recognized in my workstation.

My OS is windows 10. Just installed the latest version of docker that is 18.09.2

It is my first time with docker.

社区高分解答

原帖链接 · Maskim · CC BY-SA 4.0

This answer is more an addition at Jean-François Beauchamp's answer :
You can find full documentation about this config file on Docker's documentation.

It is stated :

--data-root is the path where persisted data such as images, volumes, and cluster state are stored.

and

--exec-root is the path where the container state is stored. The default value is /var/run/docker. Specify the path for your running daemon here.

So if you want to move both your containers and images (and the other stuff), you have to set both of these parameter.

You can also create a simple link where Docker expects its folder to redirect to the desired place.
It is described here and lead to the same result. It looks "dirty" but in the end it looks more stable than the first solution.


Working with WSL 2 engine (for Windows Home and Family Editions)

"D:\\Docker\\data-root" value as suggested by Miguel will crash Docker because it has to be a WSL folder.
However, Docker create a specific WSL distro which contains your docker data, and you can move it. This does not require to modify dockerd parameters.

To move docker's WSL distro

 wsl --export docker-desktop-data docker-desktop-data.tar
 wsl --unregister docker-desktop-data
 wsl --import docker-desktop-data X:\wslStore\ docker-desktop-data.tar --version 2

The X:\wslStore param is the path where you want to "mount" your Distro, something like D:\Docker\data-root

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-07-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。