错误"系统找不到指定的文件"挂载主机文件夹时

时间:2018-04-29 14:17:10

标签: windows docker

mount命令中指定volumerun时,无法启动Windows容器。容器运行正常,没有规范。我也试过显式创建一个卷(Docker托管)位仍然无法找到文件错误。

以下是我尝试使用基本纳米服务器图像的众多变体之一。源文件夹存在于主机上,并且我已经为每个人提供了对该文件夹的完全控制权限以进行故障排除。

docker run -it --rm --name nanoserver -d microsoft/nanoserver --mount "source=C:\HostDataForDockerContainer,target=C:\ContainerData"

错误文字:

docker: Error response from daemon: 
container 9f0b1d6ef217986b8c0225fb38e96cbc51db2d3eff79591e9f3d5288f86f2851 encountered an error during CreateProcess: 
failure in a Windows system call: 
The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--mount source=C:\\HostDataForDockerContainer,target=C:\\ContainerData","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[30,120]}.

我最近升级到最新的Docker for Windows版本,但我之前没有尝试过安装卷,所以我不知道这是否是这个Docker版本的回归问题,或者与我的主机配置或Docker使用情况隔离的东西。

根据文档,mount规范对我来说是正确的,但如果有人可以确认,我会很感激。

我的主机是运行Docker Community Edition版本18.03.1-ce-win64(17438)的Windows 10 Pro。

修改

正如@JonathonReinhart建议的那样,我尝试将mount选项重新排序为较早的参数并得到相同的错误,尽管错误消息中的额外信息表明并非在所有情况下都识别出所有参数。以下是我尝试过的排列:

docker run --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData" -it -d microsoft/nanoserver --rm --name nanoserver
docker: Error response from daemon: 
container f91312790b941a48cea49bb68d939acb648d85a078b30f0a5b74e9e7bae32147 encountered an error during CreateProcess: 
failure in a Windows system call: 
The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--rm --name nanoserver","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

docker run -it --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData" -d microsoft/nanoserver --rm --name nanoserver
docker: Error response from daemon: 
container 43fbe911dcd275f55636bd97e4b3498f7c71e265cdda6cb85dacf19bdc8464f1 encountered an error during CreateProcess: 
failure in a Windows system call: 
The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--rm --name nanoserver","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

docker run -it --rm --name nanoserver -d microsoft/nanoserver --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData"
docker: Error response from daemon: 
container 14e81f566d2ad45d3103b2e292924eab2b0490f992ae9deaf750b99c25d1ca77 encountered an error during CreateProcess: 
failure in a Windows system call: 
The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--mount type=bind,source=C:\\HostDataForDockerContainer,target=C:\\ContainerData","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

docker run -it -d microsoft/nanoserver --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData" --rm --name nanoserver
docker: Error response from daemon: 
container 20cf5692417a9d455dd4a05ff77516dc4f17d4b0d9cc8c37d29dc842b82f5007 encountered an error during CreateProcess: 
failure in a Windows system call: 
The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--mount type=bind,source=C:\\HostDataForDockerContainer,target=C:\\ContainerData --rm --name nanoserver","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

docker run -it -d microsoft/nanoserver --rm --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData" --name nanoserver
docker: Error response from daemon: 
container fba579fa3d788f4890b0c1523495742b689513150800e1b19f6f70f2a0e49819 encountered an error during CreateProcess: 
failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--rm --mount type=bind,source=C:\\HostDataForDockerContainer,target=C:\\ContainerData --name nanoserver","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

docker run -it -d microsoft/nanoserver --rm --name nanoserver --mount "type=bind,source=C:\HostDataForDockerContainer,target=C:\ContainerData"
docker: Error response from daemon: 
container 76b1117b65e6e345284c083af39fa8a627369fb5518fe89ed2519aa224f82d0a encountered an error during CreateProcess: 
failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: 
{"CommandLine":"--rm --name nanoserver --mount type=bind,source=C:\\HostDataForDockerContainer,target=C:\\ContainerData","WorkingDirectory":"C:\\","EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[57,120]}.

0 个答案:

没有答案