mirror of
https://github.com/containers/podman.git
synced 2025-10-13 09:15:20 +08:00
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:
@ -95,6 +95,10 @@ func DefineNetFlags(cmd *cobra.Command) {
|
||||
)
|
||||
_ = cmd.RegisterFlagCompletionFunc(publishFlagName, completion.AutocompleteNone)
|
||||
|
||||
netFlags.Bool(
|
||||
"no-hostname", false, "Do not create /etc/hostname within the container, instead use the version from the image",
|
||||
)
|
||||
|
||||
netFlags.Bool(
|
||||
"no-hosts", podmanConfig.ContainersConfDefaultsRO.Containers.NoHosts,
|
||||
"Do not create /etc/hosts within the container, instead use the version from the image",
|
||||
@ -192,6 +196,11 @@ func NetFlagsToNetOptions(opts *entities.NetOptions, flags pflag.FlagSet) (*enti
|
||||
}
|
||||
}
|
||||
|
||||
opts.NoHostname, err = flags.GetBool("no-hostname")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts.NoHosts, err = flags.GetBool("no-hosts")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -98,6 +98,7 @@ func init() {
|
||||
func playFlags(cmd *cobra.Command) {
|
||||
flags := cmd.Flags()
|
||||
flags.SetNormalizeFunc(utils.AliasFlags)
|
||||
podmanConfig := registry.PodmanConfig()
|
||||
|
||||
annotationFlagName := "annotation"
|
||||
flags.StringArrayVar(
|
||||
@ -139,7 +140,8 @@ func playFlags(cmd *cobra.Command) {
|
||||
)
|
||||
_ = cmd.RegisterFlagCompletionFunc(usernsFlagName, common.AutocompleteUserNamespace)
|
||||
|
||||
flags.BoolVar(&playOptions.NoHosts, "no-hosts", false, "Do not create /etc/hosts within the pod's containers, instead use the version from the image")
|
||||
flags.BoolVar(&playOptions.NoHostname, "no-hostname", false, "Do not create /etc/hostname within the container, instead use the version from the image")
|
||||
flags.BoolVar(&playOptions.NoHosts, "no-hosts", podmanConfig.ContainersConfDefaultsRO.Containers.NoHosts, "Do not create /etc/hosts within the pod's containers, instead use the version from the image")
|
||||
flags.BoolVarP(&playOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
|
||||
flags.BoolVar(&playOptions.TLSVerifyCLI, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries")
|
||||
flags.BoolVar(&playOptions.StartCLI, "start", true, "Start the pod after creating it")
|
||||
|
Reference in New Issue
Block a user