Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: List container with volume filter #16934

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/domain/filters/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo
if dest != "" && (mount.Source == source && mount.Destination == dest) {
return true
}
if dest == "" && mount.Source == source {
if dest == "" && mount.Destination == source {
return true
}
}
Expand Down
16 changes: 16 additions & 0 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,20 @@ EOF
is "$output" "" "Should print no output"
}

@test "podman ps -f" {
vol1="/v1_$(random_string)"
run_podman run -d --rm --volume ${PODMAN_TMPDIR}:$vol1 $IMAGE top
cid=$output

run_podman ps --noheading --no-trunc -q -f volume=$vol1
is "$output" "$cid" "Should find container by volume"

run_podman ps --noheading --no-trunc -q --filter volume=/NoSuchVolume
is "$output" "" "ps --filter volume=/NoSuchVolume"

# Clean up
run_podman rm -f -t 0 -a
}


SamirPS marked this conversation as resolved.
Show resolved Hide resolved
# vim: filetype=sh