部署Azure容器注册表镜像至Web App后无法运行的问题及解决
问题描述
- 已通过Azure Pipelines将Docker镜像推送至Azure Container Registry,注册表名为
myfirstregistry,镜像名为myfirstimage,标签为"8"(通过命令az acr repository show-tags -n myfirstregistry --repository myfirstimage确认)。 - 执行以下命令部署Azure Web App:
az webapp create --name my-first-app --resource-group ... --plan ... --deployment-container-image-name myfirstregistry.azurecr.io/myfirstimage:latest - 在Azure门户的
Overview->Properties->Web app->Container Image中,确认显示的镜像为myfirstregistry.azurecr.io/myfirstimage:8,但访问my-first-app.azurewebsites.net时,页面显示“Your web app is running and waiting for your content”,Docker镜像未正常运行。
解决方案
需将startup command设置为Dockerfile中的最后一条命令,本场景为python app.py,可通过以下两种方式配置:
- Azure门户操作:进入目标Azure Web App,导航至「部署中心」进行设置。
- 命令行操作:运行以下Azure CLI命令:
az webapp config show --name my-first-app --resource-group ... --startup-file="python app.py"
内容的提问来源于stack exchange,提问作者limitIntegral314
相关产品推荐
相关产品推荐

