问题原文
原帖链接 · 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-rootis the path where persisted data such as images, volumes, and cluster state are stored.
and
--exec-rootis 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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
