You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Azure CLI更新Azure Container App启动探针失败求助

正确更新Azure Container App启动探针的CLI命令

你的命令失效的核心问题是未指定容器数组的索引——properties.template.containers是数组类型,必须明确指向具体容器(比如第一个容器用containers[0]),否则CLI无法定位到要修改的目标容器探针配置。

正确的更新命令

az containerapp update --name $containerAppName --resource-group $resourceGroup --set `
  properties.template.containers[0].probes[0].type="Startup" `
  properties.template.containers[0].probes[0].httpGet.path="/" `
  properties.template.containers[0].probes[0].httpGet.port=80 `
  properties.template.containers[0].probes[0].initialDelaySeconds=20 `
  properties.template.containers[0].probes[0].periodSeconds=3

关键细节说明

  • 若容器应用包含多个容器,将containers[0]替换为对应容器的索引(如containers[1]指向第二个容器)。
  • 若容器原有多个探针(如同时存在就绪、存活探针),需确认目标探针在probes数组中的位置,或先删除旧探针再添加新配置:
    # 删除旧的目标探针(示例为第一个探针)
    az containerapp update --name $containerAppName --resource-group $resourceGroup --remove properties.template.containers[0].probes[0]
    # 添加新的启动探针
    az containerapp update --name $containerAppName --resource-group $resourceGroup --add `
      properties.template.containers[0].probes type="Startup" `
      properties.template.containers[0].probes.httpGet.path="/" `
      properties.template.containers[0].probes.httpGet.port=80 `
      properties.template.containers[0].probes.initialDelaySeconds=20 `
      properties.template.containers[0].probes.periodSeconds=3
    

验证更新结果

执行更新后,用以下命令确认配置已生效:

az containerapp show --name $containerAppName --resource-group $resourceGroup --query "properties.template.containers[0].probes"

内容的提问来源于stack exchange,提问作者Madhu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 23:51:03