Merge pull request #4333 from giuseppe/error-rootless-cni

rootless: raise an error with --network=
This commit is contained in:
OpenShift Merge Robot 2019-10-24 21:29:53 +02:00 committed by GitHub
commit 77c7a28a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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