映像拉取需要很长时间才能运行
本文讨论在Microsoft Azure 容器实例上运行映像拉取需要很长时间才能执行的操作。
先决条件
现象
容器组在长时间内停滞在“已创建”状态中。
用于容器组的图像大小很大。
原因
在容器实例中,不会永久缓存映像。 如果未缓存映像,则会从注册表中提取映像。 如果映像很大,注册表拉取可能需要很长时间。 这是大型未缓存映像的预期行为。
如果需要更快的拉取时间,可能需要检查其中一个 列出的缓存映像 是否能够成功用于你的用例。
解决方案
运行以下 az container show 命令,以便查看容器事件的时间线:
az container show --resource-group <resource-group-name> --name <container-group-name>
在此示例中, Pulling
图像事件从 16:30:51 开始,并在同一天以 16:48:43 记录成功 Pulled
事件。 因此,图像拉取需要近 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 社区支持。 你还可以将产品反馈提交到 Azure 反馈社区。