[英]Docker on Windows 10: How to move existing containers & images to new location?
I want to move my Docker containers & images from C: to elsewhere.我想将我的 Docker 容器和图像从 C: 移动到其他地方。 All containers/images are Windows-ones.
所有容器/映像都是 Windows 的。
I've changed the Docker data files location using the data-root
configuration option, restarted the daemon and desktop client, and verified the data root location with docker info
.我已经使用
data-root
配置选项更改了 Docker 数据文件位置,重新启动了守护程序和桌面客户端,并使用docker info
验证了数据根位置。
The problem is, that none of the existing containers & images are moved to the new location.问题是,现有的容器和图像都没有移动到新位置。 Just the desktop client's configuration files.
只是桌面客户端的配置文件。 The desktop client doesn't seem to offer any means for (forcing/persuading it) moving the data to new location.
桌面客户端似乎没有提供任何(强制/说服)将数据移动到新位置的方法。
Tried to address the issue by manually copying C:\\ProgramData\\Docker
contents to the new location, but everything sooner or later fails when copying special system files, such as bootmgr
, inside images in windowsfilter
(Running robocopy
in elevated PowerShell or copying in Explorer, doesn't matter).试图通过手动将
C:\\ProgramData\\Docker
内容复制到新位置来解决该问题,但是在复制特殊系统文件(例如bootmgr
、 windowsfilter
图像时,一切迟早都会失败(在提升的 PowerShell 中运行robocopy
或在资源管理器中复制,无所谓)。
Is there any way around this, to move existing images & containers without breaking everything?有没有办法解决这个问题,在不破坏一切的情况下移动现有的图像和容器? I don't have a Linux machine at my disposal I could use to mount the NTFS volumes and do the copying there.
我没有可用于安装 NTFS 卷并在那里进行复制的 Linux 机器。
I found that setting data-root
would result in new images being created on the desired drive but existing images would continue to run from the system drive (C:\\).我发现设置
data-root
会导致在所需驱动器上创建新图像,但现有图像将继续从系统驱动器 (C:\\) 运行。 I even tried deleting the windowsfilter folder on the C:\\ drive but when running the container the images were re-downloaded to the C:\\ drive instead of the configured data-root location.我什至尝试删除 C:\\ 驱动器上的 windowsfilter 文件夹,但是在运行容器时,图像被重新下载到 C:\\ 驱动器而不是配置的数据根位置。
The thing that worked for me was to perform a factory reset from the troubleshooting menu (The对我有用的是从故障排除菜单中执行恢复出厂设置(
in docker desktop is a shortcut to this menu).
在 docker desktop 中是此菜单的快捷方式)。 This will clean up the windowsfilter folder in your system drive - However I had to run factory reset twice as the first time failed.
这将清理系统驱动器中的 windowsfilter 文件夹 - 但是,由于第一次失败,我不得不两次恢复出厂设置。
After reset has completed, go to Settings->Docker Engine
and add a data-root
entry folder on another drive:重置完成后,转到
Settings->Docker Engine
并在另一个驱动器上添加一个data-root
条目文件夹:
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": false,
"experimental": false, <-- remember to add a comma here
"data-root": "E:\\dockerdata"
}
Then click Apply & Restart
然后点击
Apply & Restart
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.