无法访问泊坞窗映像中的React应用程序

森图兰

我已经实现了一个React应用程序,并做成了docker。当我运行以下命令时,我无法访问react应用程序。命令:-docker run -p 3000:3000 reactapp

> [email protected] start /usr/src/app
> react-scripts start

ℹ 「wds」: Project is running at http://172.17.0.2/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /usr/src/app/public
ℹ 「wds」: 404s will fallback to /
Starting the development server...

我收到上述消息,但无法访问react应用程序。

以下是我的docker文件。

FROM node

# A directory within the virtualized Docker environment
# Becomes more relevant when using Docker Compose later
WORKDIR /usr/src/app

# Copies package.json and package-lock.json to Docker environment
COPY package*.json ./

# Installs all node packages
RUN npm install

# Copies everything over to Docker environment
COPY . .

# Uses port which is used by the actual application
EXPOSE 3000

# Finally runs the application
CMD [ "npm", "start" ]
沙申克五世

检查您是否点击了https://github.com/facebook/create-react-app/issues/8688

您可能要使用-it选项运行Docker容器

docker run -it -p 3000:3000 reactapp

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章