Docker Build失败|命令'/bin/sh -c node -v'返回了Windows上的非零代码:4294967295
这是我试图在Windows Docker上构建的基本 dockerfile
。 docker构建。 -t nishantt95/my-node-app
FROM node:16.14.2
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY . ./
EXPOSE 3000
CMD ["npm", "start"]
完成运行
命令后,它会提示一个错误:
The command '/bin/sh -c npm i' returned a non-zero code: 4294967295: failed to shutdown container: container 89916be2224207b5aab466b1582a44a59c3375330feb698408b758f7adbcb996 encountered an error during hcsshim::System::waitBackground: failure in a Windows system call
: The virtual machine or container with the specified identifier is not running. (0xc0370110): subsequent terminate failed container 89916be2224207b5aab466b1582a44a59c3375330feb698408b758f7adbcb996 encountered an error during hcsshim::System::waitBackground: failure in
a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110)
很快我意识到我将面临所有基本 Run
运行PWD
,运行节点-V
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在窗户上构建容器存在一些问题,因此我们需要切换到Linux容器。
注释:Windows可能会提示您安装 wsl2 ,因此安装并重新启动Docker桌面。之后,重建您的
dockerfile
,它将按预期工作。There is some issue building the container on windows, hence we need to switch to Linux containers.
Note: Windows might prompt you to install WSL2 so install that and restart your docker desktop. After that, rebuild your
Dockerfile
and it will work as expected.