aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-15 18:43:59 +0000
committerGitHub <noreply@github.com>2022-08-15 18:43:59 +0000
commitfa386e91bdfcd89125918a9a255c71482a351491 (patch)
tree74fefed6af8ea113c9aea61e175267819e670969
parenta07d00a23dbe162e3c58fb04254576e30f20139c (diff)
parentb9c094a5d4f2fe9bce929aac898aad94b48169c6 (diff)
downloadpodman-fa386e91bdfcd89125918a9a255c71482a351491.tar.gz
podman-fa386e91bdfcd89125918a9a255c71482a351491.tar.bz2
podman-fa386e91bdfcd89125918a9a255c71482a351491.zip
Merge pull request #15318 from rhatdan/dns-opt
Add Docker compatibility for --dns-option to --dns-opt
-rw-r--r--cmd/podman/common/netflags.go13
-rw-r--r--test/system/500-networking.bats10
2 files changed, 23 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 {
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index b9a173c2a..5da7523f3 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -767,4 +767,14 @@ EOF
is "$output" "" "Should print no output"
}
+@test "podman network rm --dns-option " {
+ dns_opt=dns$(random_string)
+ run_podman run --rm --dns-opt=${dns_opt} $IMAGE cat /etc/resolv.conf
+ is "$output" ".*options ${dns_opt}" "--dns-opt was added"
+
+ dns_opt=dns$(random_string)
+ run_podman run --rm --dns-option=${dns_opt} $IMAGE cat /etc/resolv.conf
+ is "$output" ".*options ${dns_opt}" "--dns-option was added"
+}
+
# vim: filetype=sh