diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-10-24 10:42:49 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-10-24 20:14:24 +0200 |
commit | 8f75b3e8c95ae21fab16e4564a7056def82df649 (patch) | |
tree | 06f48c01d4fbcffd8679616e0ae63956bff87098 /libpod/options.go | |
parent | ef556cfecf4d41f63c03eedf127683dad7797e71 (diff) | |
download | podman-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.go | 7 |
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 |