Docker Build失败|命令'/bin/sh -c node -v'返回了Windows上的非零代码:4294967295

发布于 2025-01-19 15:43:34 字数 1072 浏览 0 评论 0 原文

这是我试图在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

This is a basic Dockerfile that I am trying to build on windows docker. docker build . -t nishantt95/my-node-app

FROM node:16.14.2

WORKDIR /app
COPY package*.json ./

RUN npm i

COPY . ./

EXPOSE 3000
CMD ["npm", "start"]

Once it completes a RUN command, it prompts an error:

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)

Soon I realized that I am facing this error with all the basic RUN command (e.g. RUN pwd, RUN node -v)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹梦 2025-01-26 15:43:34

在窗户上构建容器存在一些问题,因此我们需要切换到Linux容器。

注释:Windows可能会提示您安装 wsl2 ,因此安装并重新启动Docker桌面。之后,重建您的 dockerfile ,它将按预期工作。

There is some issue building the container on windows, hence we need to switch to Linux containers.

enter image description here

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文