summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/options.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index dbcc50741..e6fa987a8 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1070,6 +1070,9 @@ func WithNetNS(portMappings []nettypes.PortMapping, exposedPorts map[uint16][]st
ctr.config.PortMappings = portMappings
ctr.config.ExposedPorts = exposedPorts
+ if !ctr.config.NetMode.IsBridge() && len(networks) > 0 {
+ return errors.New("cannot use networks when network mode is not bridge")
+ }
ctr.config.Networks = networks
return nil