summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-19 02:22:28 +0200
committerGitHub <noreply@github.com>2019-07-19 02:22:28 +0200
commitb59abdc1b1cf72d86d3fe6bb76ba646870c86ed6 (patch)
tree077b0c03cbc511267dd2d6401952178a70ec3296 /cmd
parentb98e015527d5b1981307d36c40a42ca1531b583c (diff)
parent3f721f8b17780931a75f9e072e4d32bf9a49e976 (diff)
downloadpodman-b59abdc1b1cf72d86d3fe6bb76ba646870c86ed6.tar.gz
podman-b59abdc1b1cf72d86d3fe6bb76ba646870c86ed6.tar.bz2
podman-b59abdc1b1cf72d86d3fe6bb76ba646870c86ed6.zip
Merge pull request #3579 from QiWang19/dns_net
fix --dns and --network conflict
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/create.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index 262cdffe4..3c24729c5 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -2,6 +2,7 @@ package main
import (
"fmt"
+ "strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/pkg/adapter"
@@ -77,6 +78,16 @@ func createInit(c *cliconfig.PodmanCommand) error {
logrus.Warn("setting security options with --privileged has no effect")
}
+ var setNet string
+ if c.IsSet("network") {
+ setNet = c.String("network")
+ } else if c.IsSet("net") {
+ setNet = c.String("net")
+ }
+ if (c.IsSet("dns") || c.IsSet("dns-opt") || c.IsSet("dns-search")) && (setNet == "none" || strings.HasPrefix(setNet, "container:")) {
+ return errors.Errorf("conflicting options: dns and the network mode.")
+ }
+
// Docker-compatibility: the "-h" flag for run/create is reserved for
// the hostname (see https://github.com/containers/libpod/issues/1367).