【发布时间】:2020-08-11 17:42:17
【问题描述】:
我想在 Docker 中运行一个简单的 React 应用程序。它在外面运行良好,但是当我尝试从 docker 运行它时,出现以下错误,目前我不知道。
custportal_1 | yarn run v1.15.2
custportal_1 | $ react-scripts start
custportal_1 | ℹ 「wds」: Project is running at http://172.24.0.12/
custportal_1 | ℹ 「wds」: webpack output is served from
custportal_1 | ℹ 「wds」: Content not from webpack is served from /usr/src/app/public
custportal_1 | ℹ 「wds」: 404s will fallback to /
custportal_1 | Starting the development server...
custportal_1 |
custportal_1 | Done in 2.61s.
custportal_1 exited with code 0
应用程序由 create-react-app 命令创建。我的 Dockerfile 配置是
FROM node:11 as build-deps
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
同样,应用程序在外部运行良好,但在 Docker 内部调用时中断。在 docker-compose 我用
调用容器command: bash -c "export PORT=8081 && yarn start"
** 我在后台运行了 nginx 反向代理。
【问题讨论】:
-
您看到了什么错误?我只看到帖子中的命令
标签: reactjs