【发布时间】:2020-11-14 01:27:08
【问题描述】:
我的平均堆栈代码在 docker-compose 配置中工作。如果我在我的电脑上运行docker-compose up,那么我可以在localhost 上成功登录我的应用程序如果转到应用程序服务并单击 docker-compose 预览选项并上传我的 docker-compose.yml 文件。部署后,当我单击应用程序的 URL 时,我收到应用程序错误,我不知道为什么。也许我必须更改文件中的某些内容才能使其在不同的环境中工作?感谢您对此提供的任何帮助!
我在某处读到,如果在同一订阅中使用 ACR,我不必提供用户名、密码或 url 详细信息,就是这样。因此,如果是这种情况,那么身份验证就不是问题了。
前端 docker 映像和后端 docker 映像位于 azure 容器注册表中。当我在应用服务中设置 docker 时,我指向注册表 来自 azure 的 docker 日志说
2020-02-19 15:08:20.257 INFO - Starting multi-container app, configuration =
2020-02-19 15:08:22.806 ERROR - Pull image threw Exception: Object reference not set to an instance of an object.
2020-02-19 15:08:22.806 ERROR - Pulling docker image failed:
2020-02-19 15:08:22.806 ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2020-02-19 15:08:22.806 ERROR - multi-container unit was not started successfully
2020-02-19 15:08:22.831 INFO - Container logs from testinggc_backend_0_250edca0 =
2020-02-19 15:08:28.902 INFO - Stoping site testinggc because it failed during startup.
2020-02-19 15:08:30.129 INFO - Starting multi-container app, configuration =
前端 Dockerfile
FROM node
MAINTAINER Phil
WORKDIR /src
COPY . .
RUN npm install
RUN npm install -g @angular/cli
EXPOSE 4200
CMD ng serve --host 0.0.0.0 --port 4200
后端 Dockerfile
FROM node:10.16.3
MAINTAINER Phil
WORKDIR /src
COPY . /src
RUN npm install
RUN npm install -g nodemon
EXPOSE 3000
CMD ["npm", "run", "start"]
docker-compose.yml
version: '3'
services:
backend:
build: ./backend
ports:
- "3000:3000"
frontend:
build: ./frontend
ports:
- "4200:80"
【问题讨论】:
标签: node.js azure docker docker-compose azure-web-app-service