在Windows Server 2016上,安装了docker,并尝试使用nodejs运行docker映像。
docker run stefanscherer/node-windows "node -v"
使用以下“消息”引发错误:
docker:来自守护程序的错误响应:容器47c736ce10987311aee01695f735bcfda52222b9effe856c44fd492685249438在CreateProcess期间遇到错误:Windows系统调用失败:可以解释。 (0x2)额外信息:{“ CommandLine”:“ \” node -v \“”,“ WorkingDirectory”:“ C:\”,“ Environment”:{“ NPM_CONFIG_LOGLEVEL”:“ info”},“ CreateStdInPipe”:true ,“ CreateStdOutPipe”:true,“ CreateStdErrPipe”:true,“ ConsoleSize”:[0,0]}。
最奇怪的是,某些命令由于完全相同的错误而失败,某些方法可以正常工作。例如:
docker run stefanscherer/node-windows "hostname"
=> ecbf0a7a7979
docker run stefanscherer/node-windows "dir"
=>上面(encountered an error during CreateProcess
)出现相同错误
docker run stefanscherer/node-windows "pwd"
=>
(结果似乎是一个空字符串)
docker run -it stefanscherer/node-windows "cmd"
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\>node -v
v10.9.0
C:\>npm -v
npm info it worked if it ends with ok
npm info using npm@6.2.0
npm info using node@v10.9.0
npm timing npm Completed in 353ms
npm info ok
6.2.0
所以我在docker节点映像中有一个外壳...并获取节点版本以及所有版本,没有错误。
windows:Server 2016 Standard Evaluation 1607 Build14393.rs1_release.161220-1747''
docker:
λ docker -v
Docker version 18.06.1-ce, build e68fc7a
λ docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:21:34 2018
OS/Arch: windows/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.24)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:36:40 2018
OS/Arch: windows/amd64
Experimental: false
答案 0 :(得分:1)
只需删除引号:
docker run stefanscherer/node-windows node -v
这应该有效。 Windows会尝试查找名称为"node -v"
的可执行文件。