使用Docker Compose方式合并多个镜像(Images)文件,然后部署到App Service中,结果失败。报错 Linux Version 太长,不能超过4000个字符。
错误消息:
{
"code":"DeploymentFailed",
"message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details":[
{"message":"Linux Version is too long. It cannot be more than 4000 characters."}
]
}
这是因为App Service 会把 Docker compose.yml 文件中的内容以Base64格式编码后,赋值给Linux Version。而Linux Version的长度限制为4000个, 这是App Service For Linux平台限制,无法修改。
可以使用方案有:
1)精简 Docker Compose.yaml 文件,把其中App Service不支持的指令或无关紧要的内容移除。App Service不支持的选项有:https://docs.azure.cn/zh-cn/app-service/configure-custom-container?pivots=container-linux&tabs=debian#docker-compose-options
2)使用 AKS(Azure Kubernetes Service) 服务 : https://docs.azure.cn/zh-cn/aks/tutorial-kubernetes-prepare-app
3)使用 ACI (Azure Container Instance) 服务 : https://learn.microsoft.com/en-us/azure/container-instances/tutorial-docker-compose
Create Docker Comose App: https://learn.microsoft.com/en-us/azure/app-service/quickstart-multi-container#create-a-docker-compose-app