Fix: List container with volume filter

Modify the condition in line 149 in order to list container by mounting
point.
Closes #16019

Signed-off-by: SamirPS <akariohsamir@yahoo.com>
This commit is contained in:
SamirPS
2022-12-23 19:39:07 +01:00
committed by Samir Akarioh
parent 2dd9e0859c
commit e479644177
2 changed files with 17 additions and 1 deletions

View File

@ -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
}
}

View File

@ -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
}
# vim: filetype=sh