我试图运行这个项目中Github
的一个Docker
容器。这是一个简单的 reactjs 状态应用程序。
克隆后,我尝试使用以下命令在本地环境中运行它:
// install dependencies
npm install
// and then
npm start
并且完全正常。
然后我用 a 做了同样的事情Dockerfile
,如下所示:
# Use whatever version you are running locally (see node -v)
FROM node:12.13
WORKDIR /
COPY package.json /
RUN npm install
COPY . /
EXPOSE 3000
CMD ["npm", "start"]
当我使用docker-compose.yml
以下方法构建它时docker-compose up --build -d
:
version: "3.2"
services:
frontend_common:
build: .
ports:
- 80:3000
但是容器退出,当我尝试查看日志时,它没有给出错误,但输出如下:
> [email protected] start /
> react-scripts start
ℹ 「wds」: Project is running at http://<Redacted>/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /public
ℹ 「wds」: 404s will fallback to /
Starting the development server...
有人可以帮助我哪里出错了吗?
看来,这是您在使用 [email protected] 时面临的常见问题。您可以关注该问题并查看推荐的解决方法,例如github:
降级或following line
在您的 docker-compose 文件中添加:
stdin_open: true
docker-compose.yaml
version: "3.2"
services:
frontend_common:
build: .
ports:
- 80:3000
stdin_open: true
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句