共用方式為


映像提取需要很長的時間才能執行

本文討論如果映像提取需要很長的時間才能在Microsoft Azure 容器執行個體 上執行,您可以執行哪些動作。

必要條件

徵兆

  • 容器群組長時間停滯在「已建立」狀態中。

  • 用於容器群組的映像大小很大。

原因

在 容器執行個體 中,不會永遠快取影像。 如果未快取映像,則會從登錄提取映像。 如果映射很大,登錄提取可能需要很長的時間。 這是大型未快取影像的預期行為。

如果您需要更快的提取時間,您可能想要檢查其中 一個列出的快取映像 是否可順利運作,以用於您的使用案例。

解決方案

執行下列 az container show 命令,以便檢視容器事件的時間軸:

az container show --resource-group <resource-group-name> --name <container-group-name>

在此範例中 Pulling ,影像事件從 16:30:51 開始,且成功 Pulled 事件會在同一天記錄在 16:48:43。 因此,映像提取需要將近18分鐘的時間才能完成。 您可以使用這項資訊來判斷映像提取時間是否預期或異常。

{
  "containers": [
    {
      "command": null,
      "environmentVariables": [],
      "image": "pbdockerregistry-on.azurecr.io/software:166884UK",
      "instanceView": {
        "currentState": {
          "detailStatus": "",
          "exitCode": null,
          "finishTime": null,
          "startTime": "2019-01-22T16:49:11+00:00",
          "state": "Running"
        },
        "events": [
          {
            "count": 1,
            "firstTimestamp": "2019-01-22T16:30:51+00:00",
            "lastTimestamp": "2019-01-22T16:30:51+00:00",
            "message": "pulling image \"pbdockerregistry-on.azurecr.io/software:166884UK\"",
            "name": "Pulling",
            "type": "Normal"
          },
          {
            "count": 1,
            "firstTimestamp": "2019-01-22T16:48:43+00:00",
            "lastTimestamp": "2019-01-22T16:48:43+00:00",
            "message": "Successfully pulled image \"pbdockerregistry-on.azurecr.io/software:166884UK\"",
            "name": "Pulled",
            "type": "Normal"
          },
          {
            "count": 1,
            "firstTimestamp": "2019-01-22T16:48:43+00:00",
            "lastTimestamp": "2019-01-22T16:48:43+00:00",
            "message": "Created container with docker id 2dfc27ee4e6",
            "name": "Created",
            "type": "Normal"
          },
          {
            "count": 1,
            "firstTimestamp": "2019-01-22T16:49:11+00:00",
            "lastTimestamp": "2019-01-22T16:49:11+00:00",
            "message": "Started container with docker id 2edfc27ee4e6",
            "name": "Started",
            "type": "Normal"
          }
        ],
        "previousState": null,
        "restartCount": 0
      },
      "livenessProbe": null,
      "name": "<container-name>",
      "ports": [
        {
          "port": 443,
          "protocol": "TCP"
        }
      ],
      "readinessProbe": null,
      "resources": {
        "limits": null,
        "requests": {
          "cpu": 4.0,
          "memoryInGb": 4.0
        }
      },
      "volumeMounts": null
    }
  ],
  "diagnostics": null,
  "id": "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.ContainerInstance/containerGroups/<container-name>",
  "identity": null,
  "imageRegistryCredentials": [
    {
      "password": null,
      "server": "<user-name>.azurecr.io",
      "username": "<user-name>"
    }
  ],
  "instanceView": {
    "events": [],
    "state": "Running"
  },
  "ipAddress": {
    "dnsNameLabel": "<container-name>",
    "fqdn": "<container-name>.westeurope.azurecontainer.io",
    "ip": "40.119.152.151",
    "ports": [
      {
        "port": 443,
        "protocol": "TCP"
      }
    ],
    "type": "Public"
  },
  "location": "westeurope",
  "name": "<container-name>",
  "networkProfile": null,
  "osType": "Windows",
  "provisioningState": "Succeeded",
  "resourceGroup": "<resource-group-name>",
  "restartPolicy": "Always",
  "tags": {},
  "type": "Microsoft.ContainerInstance/containerGroups",
  "volumes": null
}

其他相關資訊

與我們連絡,以取得說明

如果您有問題或需要相關協助,請建立支援要求,或詢問 Azure community 支援。 您也可以向 Azure 意見反應社群提交產品意見反應。