summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-10-24 10:42:49 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-10-24 20:14:24 +0200
commit8f75b3e8c95ae21fab16e4564a7056def82df649 (patch)
tree06f48c01d4fbcffd8679616e0ae63956bff87098 /libpod/options.go
parentef556cfecf4d41f63c03eedf127683dad7797e71 (diff)
downloadpodman-8f75b3e8c95ae21fab16e4564a7056def82df649.tar.gz
podman-8f75b3e8c95ae21fab16e4564a7056def82df649.tar.bz2
podman-8f75b3e8c95ae21fab16e4564a7056def82df649.zip
rootless: raise an error with --network=
Closes: https://github.com/containers/libpod/issues/4332 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index ddc5993af..8fc614e6b 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1014,6 +1014,13 @@ func WithNetNS(portMappings []ocicni.PortMapping, postConfigureNetNS bool, netmo
ctr.config.NetMode = namespaces.NetworkMode(netmode)
ctr.config.CreateNetNS = true
ctr.config.PortMappings = portMappings
+
+ if rootless.IsRootless() {
+ if len(networks) > 0 {
+ return errors.New("cannot use CNI networks with rootless containers")
+ }
+ }
+
ctr.config.Networks = networks
return nil