简体   繁体   English

流行的反应问题:如何使用 docker-compose 在 Azure 中运行为 reactjs 应用程序提供服务的 docker 容器?

[英]POPULAR REACT ISSUE : How to run docker container serving a reactjs app in Azure using docker-compose?

I have been following this guide: https://www.docker.com/blog/how-to-deploy-containers-to-azure-aci-using-docker-cli-and-compose/ to deploy containers in Azure.我一直在遵循本指南: https : //www.docker.com/blog/how-to-deploy-containers-to-azure-aci-using-docker-cli-and-compose/在 Azure 中部署容器。 When I run "docker compose up", I see the containers running in Azure but the reactjs container doesn't start properly.当我运行“docker compose up”时,我看到容器在 Azure 中运行,但 reactjs 容器无法正常启动。 The logs show it fails with :日志显示它失败了:

[34mℹ[39m [90m「wds」[39m: webpack output is served from 
[34mℹ[39m [90m「wds」[39m: Content not from webpack is served from /app/public
[34mℹ[39m [90m「wds」[39m: 404s will fallback to /
 Starting the development server...

Following is my docker-compose file :以下是我的 docker-compose 文件:

version: "3.8"

services:
   frontend:
     image: suyashpatel98/tic-tac-toe-frontend
     stdin_open: true
     tty: true
     environment:
       - CI=true
     depends_on:
       - backend
     expose:
       - "3000"
     ports:
       - "3000:3000"
   backend:
     image: suyashpatel98/tic-tac-toe-backend
     ports:
       - "8080:8080"

Locally both frontend and backend containers run just fine after "docker-compose up" command is executed but I run into the aforementioned error when I try to run the containers on Azure.在执行“docker-compose up”命令后,前端和后端容器在本地都运行得很好,但是当我尝试在 Azure 上运行容器时遇到了上述错误。 Please find the source-code for reference here: https://github.com/suyashpatel98/tic-tac-toe-app请在此处找到源代码以供参考: https : //github.com/suyashpatel98/tic-tac-toe-app

将 react-scripts 降级到 3.4.0 对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 docker-compose 构建应用程序时,如何在 React 应用程序中为 URL 端点使用 Docker 容器名称? - How to use Docker container name for URL endpoint in React app when building app with docker-compose? 如何使用docker-compose构建和部署ReactJs - How to build and deploy ReactJs using docker-compose 如何在 docker-compose 中制作 React 应用程序? 构建步骤完成后容器正在退出 - How do I make a react app in docker-compose? Container is exiting after build steps are complete 在 docker-compose 上使用 nginx 代理 React 应用程序 - Proxying react app using nginx on docker-compose React App 不会刷新使用 Docker-Compose 的更改 - React App doesn't refresh on changes using Docker-Compose 反应应用程序未加载 docker-compose - React app not loading with docker-compose Docker/Reactjs/Nodejs - 如何在 docker-compose up 后安装依赖项并运行应用程序 - Docker/Reactjs/Nodejs - How to install dependencies and run application after docker-compose up 使用服务名称将 docker-compose React 容器中的 API 调用到 django 容器 - Calling API in a docker-compose React container to django container using service name 如何在 Docker 容器中运行我的 React 应用程序 - How to run my react app in Docker container 应用程序与 docker-compose 发生反应 - application react with docker-compose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM