8.7.4. 使用注解删除标签过期
使用 oras CLI 工具,您可以取消设置之前建立的过期时间。
先决条件
-
您已下载了
orasCLI。如需更多信息,请参阅安装 https://oras.land/docs/installation。 -
已使用
quay.expires-after=<value> 注解推送镜像。
流程
输入以下
oras push --annotation命令删除所需镜像标签的注释。该注解的格式应为quay.expires-after=never。例如:$ oras push --annotation quay.expires-after=never \ <quay-server.example.com>/<organization>/<repository>:<tag> \ <file_path>:<media_type>输出示例
✓ Uploaded hello.txt 12/12 B 100.00% 321ms └─ sha256:74b9e308133afb3bceae961097cb2aa481483869d695ce1414cd2bc7f046027c ✓ Uploaded application/vnd.oci.empty.v1+json 2/2 B 100.00% 328ms └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a ✓ Uploaded application/vnd.oci.image.manifest.v1+json 620/620 B 100.00% 0s └─ sha256:c370e931b5eca44fd753bd92e6991ed3be70008e8df15078083359409111f8c3 Pushed [registry] quay-server.example.com/fortestuser/busybox:test2 ArtifactType: application/vnd.unknown.artifact.v1最新清单将不再有过期时间。通过检查 Red Hat Quay UI 或输入以下命令来确认已删除过期日期:
{"tags": [{"name": "test2", "reversion": false, "start_ts": 1743708135, "manifest_digest": "sha256:19e3a3501b4125cce9cb6bb26ac9207c325259bef94dc66490b999f93c4c83a9", "is_manifest_list": false, "size": 12, "last_modified": "Thu, 03 Apr 2025 19:22:15 -0000"}, {"name": "test2", "reversion": false, "start_ts": 1743706344, "end_ts": 1743708135}]}请注意,没有列出过期时间。