You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for regexp in --filter name=<value> #4323
In the docker CLI, filters can use regexp. However, in nerdctl, the filters generally need to be an exact match.
For example, using the name filter in docker:
❯ docker ps
❯ docker ps --filter name="foo-"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9dd7fabec4fc alpine "sleep 1000000" 14 seconds ago Up 14 seconds foo-bar
❯ docker ps --filter name="foo-.*"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9dd7fabec4fc alpine "sleep 1000000" 22 seconds ago Up 22 seconds foo-bar
And in nerdctl:
❯ nerdctl ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d21c34b4b65a docker.io/library/alpine:latest "sleep 1000000" About a minute ago Up
❯ nerdctl ps --filter name="foo-"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d21c34b4b65a docker.io/library/alpine:latest "sleep 1000000" About a minute ago Up foo-bar
❯ nerdctl ps --filter name="foo-.*"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
It would be nice to be able to use regexp in filters, or even to check for an exact match (AFAICT, that's not possible based on the logic here).
Describe the solution you'd like
At least the various name filters in different places (specifically container/list.go and volume/list.go) should support regexp, not sure about the others (maybe labels?).
Not entirely sure what the backwards compatibility guidelines are, since just switching the logic would be a backwards incompatible change.
Additional context
Would be happy to throw together a patch if this sounds good!
Not entirely sure what the backwards compatibility guidelines are, since just switching the logic would be a backwards incompatible change.
@jedevc IMO it is fine to break backward compatibility IF we are aligning with docker behavior (not being docker compatible is usually considered a bug).
Wanna go for it? Alternatively I can look into it too.
We don't does nerdctl directly, but we do a couple of shell invocations of the docker cli to provision the dagger engine (sort of like the moby connhelpers).
We want to support whatever environments users are using! 🎉 and increasingly often, that's nerdctl (through tooling like finch, though also standalone).
Wanna go for it? Alternatively I can look into it too.
Yeah, I'll take a look! I haven't had a chance to work on anything in nerdctl yet, so it'll be a fun excuse 😁
Activity
jpadams commentedon Jun 18, 2025
I'd be happy to see this for
nerdctl ps --filterat least.cc @pendo324
apostasie commentedon Jun 18, 2025
Curious if you folks use nerdctl at Dagger?
apostasie commentedon Jun 18, 2025
@jedevc IMO it is fine to break backward compatibility IF we are aligning with docker behavior (not being docker compatible is usually considered a bug).
Wanna go for it? Alternatively I can look into it too.
jedevc commentedon Jun 18, 2025
We don't does nerdctl directly, but we do a couple of shell invocations of the docker cli to provision the dagger engine (sort of like the moby
connhelpers).We want to support whatever environments users are using! 🎉 and increasingly often, that's nerdctl (through tooling like finch, though also standalone).
Yeah, I'll take a look! I haven't had a chance to work on anything in nerdctl yet, so it'll be a fun excuse 😁
apostasie commentedon Jun 18, 2025
Go for it! :-)
Tentatively, something like that would do just fine for
foldNameFilter(I believe that would still be backward compatible):Of course, we should have it wherever Docker supports it (not just name), and yeah, we need tests :-)