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

@ -1,9 +1,9 @@
####> This option file is used in:
####> podman build, farm build
####> podman build, create, farm build, kube play, pod create, run
####> If file is edited, make sure the changes
####> are applicable to all of those.
#### **--no-hostname**
Do not create the _/etc/hostname_ file in the container for RUN instructions.
Do not create the _/etc/hostname_ file in the containers.
By default, Buildah manages the _/etc/hostname_ file, adding the container's own hostname. When the **--no-hostname** option is set, the image's _/etc/hostname_ will be preserved unmodified if it exists.
By default, Podman manages the _/etc/hostname_ file, adding the container's own hostname. When the **--no-hostname** option is set, the image's _/etc/hostname_ will be preserved unmodified if it exists.

View File

@ -62,6 +62,10 @@ Valid placeholders for the Go template are listed below:
| .SizeRw | Size of upper (R/W) container layer, in bytes [1] |
| .State ... | Container state info (struct) |
| .StaticDir | Path to container metadata dir (string) |
| .UseImageHostname | Use /etc/hostname from the image if it exists? (string: true/false)
|
| .UseImageHosts | Use /etc/hosts from the image? (string: true/false)
|
[1] This format specifier requires the **--size** option

View File

@ -268,6 +268,8 @@ If used together with **--pod**, the container does not join the pod's network n
@@option no-healthcheck
@@option no-hostname
@@option no-hosts
This option conflicts with **--add-host**.

View File

@ -228,6 +228,8 @@ Note: When joining multiple networks use the **--network name:mac=\<mac\>** synt
When no network option is specified and *host* network mode is not configured in the YAML file, a new network stack is created and pods are attached to it making possible pod to pod communication.
@@option no-hostname
@@option no-hosts
This option conflicts with host added in the Kubernetes YAML.

View File

@ -128,6 +128,8 @@ Invalid if using **--dns**, **--dns-option**, or **--dns-search** with **--netwo
@@option network-alias
@@option no-hostname
@@option no-hosts
This option conflicts with **--add-host**.

View File

@ -287,6 +287,8 @@ If used together with **--pod**, the container joins the pod's network namespace
@@option no-healthcheck
@@option no-hostname
@@option no-hosts
This option conflicts with **--add-host**.