Docker 用于容器的 Azure Web 应用程序上的 Web 应用程序
Docker web app on Azure Web App for Container
我是 docker 和 Azure 容器服务的新手。我正在尝试在容器的 Azure Web 应用程序中将 docker Web 应用程序部署为单个容器实例。在标记 docker 图像并将其推送到 Azure 容器寄存器后,我正在使用 here. I followed the steps provided here 提供的 azure-vote-front 图像。
但是在部署网络应用程序并导航到网络后 url,它只显示
502 错误网关
下面提到 nginx/1.15.8。是否有其他配置,我需要在任何文件中提及或在任何地方配置?
对于你的问题,你误解了图像azure-vote-front
。您可以在 Github link 中提供 docker-compose.yaml 文件,它会创建 azure-vote-front
图像,但它还需要数据库 Redis。所以它不是单个容器实例,而是多个容器。
您可能需要创建映像 azure-vote-front
并将其推送到 Azure 容器注册表。图像 Redis
也一样。然后你可以像这样更改 docker-compose.yaml
文件:
version: '3.7'
services:
azure-vote-back:
image: youracrname.azurecr.io/redis
container_name: azure-vote-back
ports:
- "6379:6379"
azure-vote-front:
image: youracrname.azurecr.io/azure-vote-front
container_name: azure-vote-front
environment:
REDIS: azure-vote-back
ports:
- "80:80"
并使用此处的命令设置 ACR 凭据:
az webapp config container set -g group_name -n app_name --docker-registry-server-url youracrname.azurecr.io --docker-registry-server-user acr_username --docker-registry-server-password acr_password
最后,等待几分钟就可以访问Web App了。有关详细信息,请参阅示例 Create a multi-container (preview) app in Web App for Containers.
我是 docker 和 Azure 容器服务的新手。我正在尝试在容器的 Azure Web 应用程序中将 docker Web 应用程序部署为单个容器实例。在标记 docker 图像并将其推送到 Azure 容器寄存器后,我正在使用 here. I followed the steps provided here 提供的 azure-vote-front 图像。
但是在部署网络应用程序并导航到网络后 url,它只显示 502 错误网关 下面提到 nginx/1.15.8。是否有其他配置,我需要在任何文件中提及或在任何地方配置?
对于你的问题,你误解了图像azure-vote-front
。您可以在 Github link 中提供 docker-compose.yaml 文件,它会创建 azure-vote-front
图像,但它还需要数据库 Redis。所以它不是单个容器实例,而是多个容器。
您可能需要创建映像 azure-vote-front
并将其推送到 Azure 容器注册表。图像 Redis
也一样。然后你可以像这样更改 docker-compose.yaml
文件:
version: '3.7'
services:
azure-vote-back:
image: youracrname.azurecr.io/redis
container_name: azure-vote-back
ports:
- "6379:6379"
azure-vote-front:
image: youracrname.azurecr.io/azure-vote-front
container_name: azure-vote-front
environment:
REDIS: azure-vote-back
ports:
- "80:80"
并使用此处的命令设置 ACR 凭据:
az webapp config container set -g group_name -n app_name --docker-registry-server-url youracrname.azurecr.io --docker-registry-server-user acr_username --docker-registry-server-password acr_password
最后,等待几分钟就可以访问Web App了。有关详细信息,请参阅示例 Create a multi-container (preview) app in Web App for Containers.