【发布时间】:2021-08-02 05:23:59
【问题描述】:
我尝试为客户端应用(nextjs 应用)构建映像,但构建始终失败。
这是 docker 文件:
FROM node:12.18.3
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json /app/
COPY package-lock.json /app/
RUN npm install
COPY . /app
RUN npm build
# start app
CMD [ "npm", "start" ]
第一步失败并出现此错误:
Step 1/9 : FROM node:12.18.3
operating system is not supported
我关注了这个帖子 https://stackoverflow.com/a/51071057/9608006 ,将 experimental 设置更改为 true,它确实通过了失败的步骤。
但现在它在npm i 步骤上失败了
npm notice
The command '/bin/sh -c npm install' returned a non-zero code: 4294967295: failed to shutdown container: container c425947f7f17ed39ed51ac0a67231f78ba7239ad199c7df979b3b442969a0a57 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 c425947f7f17ed39ed51ac0a67231f78ba7239ad199c7df979b3b442969a0a57 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)
在此步骤开始时我也收到此警告:
Step 6/9 : RUN npm install
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (windows/amd64) and no specific platform was requested
我用windows 10,
docker v20.10.5
有什么问题?
编辑 1 - 文件夹结构
以下是客户端应用程序的基础文件夹层
- .下一个
- .vercel
- 组件
- 枚举
- 挂钩
- node_modules
- 页
- 公开
- 商店
- 样式
- 实用工具
- .dockerIgnore
- .env.local
- next.config.js
- package.json
- server.js
【问题讨论】:
-
您的 Docker 桌面版是什么?另外,您的 WSL 版本是多少?
标签: node.js docker npm next.js