我需要在Windows docker容器中的A:驱动器下共享一个网络驱动器。 我需要共享的网络驱动器不是空的,我需要使用正确的权限来访问它。 我该如何实现?我只找到有关人们映射其C:驱动器的帖子。
应该在构建过程中还是在运行时完成?
它尝试了显而易见的
docker run -it --rm --name windows my/image --privileged -v \\ip\mount\my\folder:A:\my\folder
但我收到此错误:
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF6F8AFAE77: (caller: 00007FF6F8AAE4AB) Exception(2) tid(39c) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
我在Windows 10 Pro 1903上使用Docker Desktop 2.2.0.0
编辑: 我应该在看起来好象卷之后设置图像。使用以下命令,错误有所不同:
docker run -it --rm --name windows --privileged -v \\ip\mount\my\folder:A:\my\folder my/image
docker: Error response from daemon: invalid volume specification: '\\ip\mount\my\folder:A:my\folder'
答案 0 :(得分:0)
您需要为Docker容器创建gMSA。实际上,IT团队应该为您做到这一点(例如,遵循此tutorial)。 然后,他们将为您提供凭据文件。然后,您可以使用以下命令运行Docker容器:
docker run -it --rm --name windows --security-opt "credentialspec=file://my_credentials.json" my/image
然后,在容器中,您可以使用net use
将卷装入所需的字母下。
但是,您不能在容器运行命令中执行此操作。