Add --no-hostname option

Fixes: https://github.com/containers/podman/issues/25002

Also add the ability to inspect containers for
UseImageHosts and UseImageHostname.

Finally fixed some bugs in handling of --no-hosts for Pods,
which I descovered.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2025-01-13 12:05:25 -05:00
parent 04e6488315
commit 6565bde6e8
35 changed files with 160 additions and 21 deletions

View File

@@ -1711,4 +1711,21 @@ search | $IMAGE |
run_podman rm -f -t0 $cname
}
# bats test_tags=ci:parallel
@test "podman run - no-hostname" {
randomname=c_$(safename)
echo "\
from $IMAGE
RUN umount /etc/hostname; rm /etc/hostname
" > $PODMAN_TMPDIR/Containerfile
run_podman build -t $randomname --cap-add SYS_ADMIN ${PODMAN_TMPDIR}
run_podman run --rm $randomname ls /etc/hostname
run_podman 1 run --no-hostname --rm $randomname ls /etc/hostname
is "$output" "ls: /etc/hostname: No such file or directory" "container did not add /etc/hostname"
run_podman rmi $randomname
}
# vim: filetype=sh