File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -732,6 +732,20 @@ func parseNetworkOpts(copts *containerOptions) (map[string]*networktypes.Endpoin
732732 hasUserDefined , hasNonUserDefined bool
733733 )
734734
735+ if len (copts .netMode .Value ()) == 0 {
736+ n := opts.NetworkAttachmentOpts {
737+ Target : "default" ,
738+ }
739+ if err := applyContainerOptions (& n , copts ); err != nil {
740+ return nil , err
741+ }
742+ ep , err := parseNetworkAttachmentOpt (n )
743+ if err != nil {
744+ return nil , err
745+ }
746+ endpoints ["default" ] = ep
747+ }
748+
735749 for i , n := range copts .netMode .Value () {
736750 n := n
737751 if container .NetworkMode (n .Target ).IsUserDefined () {
@@ -792,7 +806,7 @@ func applyContainerOptions(n *opts.NetworkAttachmentOpts, copts *containerOption
792806 n .Aliases = make ([]string , copts .aliases .Len ())
793807 copy (n .Aliases , copts .aliases .GetAll ())
794808 }
795- if copts .links .Len () > 0 {
809+ if n . Target != "default" && copts .links .Len () > 0 {
796810 n .Links = make ([]string , copts .links .Len ())
797811 copy (n .Links , copts .links .GetAll ())
798812 }
You can’t perform that action at this time.
0 commit comments