aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-08-15 07:38:01 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2022-08-15 07:38:08 -0400
commitb9c094a5d4f2fe9bce929aac898aad94b48169c6 (patch)
tree75e4665d26f21f89410fbef4f6bcebd7724bcea4 /cmd/podman/common
parent4136496ee713982daf3136ffe65d11a4163fabb8 (diff)
downloadpodman-b9c094a5d4f2fe9bce929aac898aad94b48169c6.tar.gz
podman-b9c094a5d4f2fe9bce929aac898aad94b48169c6.tar.bz2
podman-b9c094a5d4f2fe9bce929aac898aad94b48169c6.zip
Add Docker compatibility for --dns-option to --dns-opt
Fixes one of the issues found in https://github.com/containers/podman/issues/14917 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/netflags.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index e7aa265d1..90f05ab15 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -39,6 +39,11 @@ func DefineNetFlags(cmd *cobra.Command) {
"Set custom DNS options",
)
_ = cmd.RegisterFlagCompletionFunc(dnsOptFlagName, completion.AutocompleteNone)
+ netFlags.StringSlice(
+ "dns-option", containerConfig.DNSOptions(),
+ "Docker compatibility option== --dns-opt",
+ )
+ _ = netFlags.MarkHidden("dns-option")
dnsSearchFlagName := "dns-search"
netFlags.StringSlice(
@@ -146,6 +151,14 @@ func NetFlagsToNetOptions(opts *entities.NetOptions, flags pflag.FlagSet) (*enti
opts.DNSOptions = options
}
+ if flags.Changed("dns-option") {
+ options, err := flags.GetStringSlice("dns-option")
+ if err != nil {
+ return nil, err
+ }
+ opts.DNSOptions = append(opts.DNSOptions, options...)
+ }
+
if flags.Changed("dns-search") {
dnsSearches, err := flags.GetStringSlice("dns-search")
if err != nil {