Docker Compose 构建失败 - 文件共享已被取消

inf*_*roz 100 windows docker docker-compose docker-desktop

我遇到了 Docker Desktop 的问题,目前我在 Stackoverflow 上以用户身份运行边缘版本。在我因未知原因未共享驱动器错误之前,该错误已通过安装边缘版本“解决”:Docker for Windows:驱动器共享因未知原因失败

现在安装了这个,我收到了这个新错误,它阻止了一些容器的构建。这些容器都已经过测试并且可以在其他几个系统上运行。目前 4 个容器中有 3 个没有构建,它们都产生如下相同的错误:

ERROR: for db  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}
Encountered errors while bringing up the project.
Run Code Online (Sandbox Code Playgroud)

完整错误:

Creating imt2291-part2_www_1 ...
Creating imt2291-part2_phpmyadmin_1 ... done
Creating imt2291-part2_db_1         ...
Creating imt2291-part2_test_1       ... error
Creating imt2291-part2_www_1        ... error
ERROR: for imt2291-part2_test_1  Cannot create container for service test: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for imt2291-part2_www_1  Cannot create container for service www: status Creating imt2291-part2_db_1         ... error
lled"}

ERROR: for imt2291-part2_db_1  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for test  Cannot create container for service test: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for www  Cannot create container for service www: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}

ERROR: for db  Cannot create container for service db: status code not OK but 500: {"Message":"Unhandled exception: Filesharing has been cancelled"}
Encountered errors while bringing up the project.
Run Code Online (Sandbox Code Playgroud)

有没有人以前遇到过这个问题并找到了解决方法?

小智 184

您需要更新 Docker for Windows 应用程序中的文件共享配置(2.2.0.0 中有一个新的安全强化,它具有积极的默认值)。添加您需要的所有文件夹,然后重新启动 Docker for Windows。

例子


Rej*_*lam 54

将“文件共享”更改为 C 驱动器后,它开始在我的 Windows 机器上工作。我正在使用 docker 桌面 2.3.0.3

在此处输入图片说明

  • 无论如何,绑定确切的目录不起作用,但是挂载整个 C:\ 驱动器却起作用。诡异的。 (6认同)
  • Rajoanula Alam,您不需要将整个 C 文件夹添加到共享文件夹,只需将包含 Dockerfile 的父项目添加到共享文件即可。您可以添加许多文件夹,但单击 + 按钮。 (3认同)