image prune: --filter until= with an empty value is ignored and prunes every unused image
维护者通常 2 天内回复
评估
调研方向
Start with pkg/imgutil/filtering.go and the reported ParseFilters check, then read TestFilterUntil and the parsing tests. The issue reports an open linked pull request (#5304), so work is already underway. Done means ParseFilters([]string{"until="}) returns the expected “no until timestamp provided” error.
由索引模型根据 Issue 内容生成。
描述
Description
imgutil.ParseFilters accepts until= with an empty value, and nerdctl image prune then ignores the filter and prunes every image it would prune without a filter.
In pkg/imgutil/filtering.go the check for an empty timestamp looks at the filter name instead of the value, so it can never fail:
} else if tempFilterToken[0] == FilterUntilType {
if len(tempFilterToken[0]) == 0 { // tempFilterToken[0] is "until"
return nil, errNoUntilTimestamp
f.Until stays empty, and pkg/cmd/image/prune.go only adds the until filter when len(parsedFilters.Until) > 0. So nerdctl image prune -a --filter until= removes all unused images (and without -a all dangling images) instead of returning no until timestamp provided, which is what FilterUntil("") and the existing TestFilterUntil expect. It also matters in scripts that build the value, for example --filter until=$(some-command) where the command prints nothing, together with --force.
I found this by reading the code and checked it with a unit test on ParseFilters, not by running nerdctl image prune against containerd.
Steps to reproduce the issue
_, err := imgutil.ParseFilters([]string{"until="})
// err is nil, errNoUntilTimestamp is expected
Or nerdctl image prune -a --force --filter until= on a host with unused images.
Describe the results you received and expected
Received: no error, and the unused images are removed as if no filter was given.
Expected: no until timestamp provided, and nothing is removed.
What version of nerdctl are you using?
main (5140812f)
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
No
Host information
macOS, go1.26.8 (the unit test does not need containerd)
- 主要语言
- Go
- 星标
- 10.5k
- 派生
- 839
- 平均合并
- 3 天 22 小时
- 30 天内合并 PR
- 38
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
containerd/nerdctl 的其他 Issue
-
Test and examples: update wordpress images (to silence potential false security alerts)可能重新可做 @ayushpratap27 于 8 天前认领,目前没有进行中的 PR。 未关闭area/ci documentation priority/low
难度 2/5 1-3 小时 新手友好度 74/100
containerd/nerdctl#5283 · 2 条评论 ·
维护者通常 2 天内回复
-
`nerdctl kill` shouldn't set `containerd.io/restart.explicitly-stopped` label for non-stop signals可能已有人在做 @AdamMagued 于 1 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
containerd/nerdctl#5171 · 3 条评论 ·
维护者通常 2 天内回复
-
v2.4.2 planning未关闭area/project
难度 5/5 一周以上 新手友好度 20/100
containerd/nerdctl#5294 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
CI: migrate `ecr.aws` images to GHCR (to avoid the ECR rate limit)可能已有人在做 @mainguyen0112 于 2 天前认领。 未关闭area/ci priority/high
containerd/nerdctl#5293 · 6 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
nerdctl rm -f exits 0 when task deletion fails, so callers cannot detect a failed removal可能已有人在做 @sarankumar1325 于 6 天前认领。 未关闭bug
难度 4/5 3-5 天 新手友好度 35/100
containerd/nerdctl#5288 ·
维护者通常 2 天内回复
查看 containerd/nerdctl 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
schema-drift
难度 2/5 1-3 小时 新手友好度 72/100
stefanhoth/paperless-ngx-cli#61 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
slavakurilyak/awesome-ai-agents#888 ·
维护者通常 1 天内回复
-
enhancement nav-pilot
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
kind/enhancement
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复