diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 19c5d3bc070c..130cb6b15e9f 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -729,6 +729,20 @@ func parseNetworkOpts(copts *containerOptions) (map[string]*networktypes.Endpoin hasUserDefined, hasNonUserDefined bool ) + if len(copts.netMode.Value()) == 0 { + n := opts.NetworkAttachmentOpts{ + Target: "default", + } + if err := applyContainerOptions(&n, copts); err != nil { + return nil, err + } + ep, err := parseNetworkAttachmentOpt(n) + if err != nil { + return nil, err + } + endpoints["default"] = ep + } + for i, n := range copts.netMode.Value() { n := n if container.NetworkMode(n.Target).IsUserDefined() {