如何获取特定时间未使用(拉取)的ACR图像细节?

How to get ACR image details that are not used (pulled) for a specific period?

我有两个关于ACR镜像拉取的问题。

  1. 是否有可能获取 ACR docker 图片的拉取计数?
  2. 我们能否获取特定时间段内未拉取的 docker 个镜像的详细信息?比如最近7天没有拉取的镜像?
  1. Is there a possibility to get the pull count of an ACR docker image?
  2. Can we get the details of docker images that are not pulled for a specific time period? For example, the images that are not pulled for the last 7 days?

正如我在上面的评论中提到的,您可以通过在容器注册表上启用诊断设置并将这些日志传递到日志分析工作区来实现这一点。您可以编写一些自定义 kusto 查询并根据您的要求提取日志。

以下查询有助于获取一段时间内从 acr 提取图像的次数。

ContainerRegistryRepositoryEvents| where ArtifactType contains "acr.docker"
|where Repository contains "<repoName>" and Tag contains "<TagName>"
| where OperationName contains "Pull"
| where TimeGenerated > ago(24h)
| count 

您可以参考 this 文档以获取更多示例 Kusto 查询。