- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 ACR,它包含适用于我的生产和开发环境的 docker 镜像。由于每天都有新的图像被推送,我正在尝试设置保留策略。我的具体用例如下,
根据图像,假设我在 ACR 中有 100 个图像,第 100 个图像由开发环境消耗。然而,生产运行的是第 40 个图像。话虽这么说,我需要保留生产环境和开发环境的当前和最后 2 个镜像。例如,我需要保留第38、39和40张图像以及第98、99和100张图像。
我尝试使用acr purge
。不幸的是,我无法在我的用例中使用保留策略或 acr 清除(根据我的理解,也许我是错的)。
任何人都可以帮我解决这个问题吗?如果您需要更多信息或要求含糊,请告诉我!
最佳答案
请检查使用 azure CLI 命令的以下脚本是否可以工作:
它使用 Delete by tag方法。为此,您需要在系统上安装 azure cli。
$registryName = 'registryName'
$doNotDeleteTags = ''
$skipLastTags = 3
$repoArray = (az acr repository list --name $registryName --output json | ConvertFrom-Json)
foreach ($repo in $repoArray)
{
$tagsArray = (az acr repository show-tags --name $registryName --repository $repo --orderby time_asc --output json | ConvertFrom-Json ) | Select-Object -SkipLast $skipLastTags
foreach($tag in $tagsArray)
{
if ($donotdeletetags -contains $tag)
{
Write-Output ("This tag is not deleted $tag")
}
else
{
az acr repository delete --name $registryName --image $repo":"$tag --yes
}
}
}
引用:Azure Container Registry - delete all images except 2 - Stack Overflow
(或)
az acr repository show-tags -n MyRegistry --repository MyRepository
| ConvertFrom-String
| %{$_.P2 -replace "[",]",""}
| where {$_ -notin "skipthistag","andthistag" }
| % {az acr repository delete --name MyRegistry --image MyRepository:$_ --yes}
引用:How to delete image from Azure Container Registry - Stack Overflow
<小时/>引用资料 - 跳过最后 x 张图像:
其他引用:
关于Azure 容器注册表保留策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70360107/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 6 年前。
如何打开注册表 Win98/98SE/Me 运行中输入regedit.exe 无权限限制 Win2000/XP 1·开始>>运行.中输入regedit 2.运行中
目录 前言 使用简单工厂改进 使用注册表改进 参考文章 前言 在上一篇文章中我们提到了抽象工厂模式初版代码的一些缺点:①客户端违反开闭原则②提供方违反开
目录 工厂方法模式的瑕疵 注册表 工厂方法模式的瑕疵 在前一篇笔记中我们介绍了工厂方法模式,示例的类图如下: 考虑一种情况:现在要在程序运行时,根据外部资源
我在一个带有一个主节点和两个节点的 AWS 集群中安装了 mesosphere,分别称为主节点、节点 1 和节点 2。主节点是可见的,节点是私有(private)的。 我得到一个默认运行的马拉松实例和
我想用 PHP 制作一个注册表,将他们的用户名和密码注册到我的 SQL 数据库中。这是我所拥有的: 配置.php: 索引.php: Deltalus Account Regi
我正在尝试将我的软件添加到注册表中,我找到了一些我可以使用的代码,但不是完整的工作代码 C/C++ 对我来说是新的,无法自己创建它。但基本思想是:检查 reg key 是否已设置(如果未创建)。 我能
我尝试创建一个注册 php 代码,这样当我不在计算机旁时我就可以注册人们,但由于某种原因,它不会创建表,也不会创建文件夹,即使不存在。 输出是: ( ! ) Notice: Undefined var
我使用 HKLM\Software\etc\etc 来存储我的基本设置,这基本上是我的程序及其相关数据库的位置。 我现在遇到的问题是我已经创建了一个 Windows 服务并且需要读取这些位置。我无法将
我正在尝试将我的软件添加到注册表中,我找到了一些我可以使用的代码片段,但不是完整的工作代码 C/C++ 对我来说是新的,我无法自己创建它。但这里是基本的想法:如果没有创建它,请检查是否设置了注册键。
1、保存以下代码到:c:\windows\system32\vdm.vbs 复制代码 代码如下: Dim Args Set Args = WScript.Argum
不懂注册表、VBS、批处理不要紧,只要会学、会吸收别人的精华,会查找资料,|论坛|百度|GOOGLE|,然后能用好,就非常不错了 贴一些搜集的文字放到这吧。(绿色是标题, 蓝色的是原作者
(绿色是标题, 蓝色的是原作者,红色的部分就是需要修改的部分,根据你自己的实际情况修改) ======打开迅闪菜单的同时连接虚拟磁盘的VBS====== Set WshShell = WScrip
简单使用 复制代码 代码如下: <?php require_once("Zend/Loader.php"); Zend_Loader::loadCl
但并不是每次都打开同一个键值,在每多时候我们还是习惯于Windows 98那样每次打开都在根目录中。 通过修改注册表可以达到这样的效果。打开HKEY_CURRENT_USER\Software\M
何谓REG文件 REG文件实际上是一种注册表脚本文件,双击REG文件即可将其中的数据导入到注册表中。利用REG文件我们可以直接对注册表进行任何修改操作,它对注册表的操作可以不受注册表编辑器被禁用的
我应该将哪些数据和位置添加到 Windows 注册表中以正确创建文件关联? 我问这个问题主要是因为我多年前编写的一些旧应用程序使用 Visual Studio .NET 的 Windows Insta
我想阻止对默认 docker.io 注册表的访问。为了安全/IP 保护,我们需要阻止对公共(public) Docker 集线器的推/拉访问。 已有许多尝试将此作为配置选项,但所有 PR 都不断被拒绝
Lua 提供了一个 "registry" “任何 C 代码都可以使用它来存储它需要存储的任何 Lua 值”。正如 here 所说,线程“与原始线程共享其全局环境” .但是我找不到任何地方说它是否共享注
我的软件在 HKCU\Software\mysoftware 中存储了一些值,这从来都不是问题。但是,我现在还在 HKCU\Software\mysoftware\Licenses 中存储了一些值 -
我是一名优秀的程序员,十分优秀!