1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #38291 from tonistiigi/builder-networking-performance

builder: fix inefficient networking config
This commit is contained in:
Tibor Vass 2018-11-29 16:58:16 +01:00 committed by GitHub
commit baab736a36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,7 @@ import (
"github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util/network"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
const networkName = "bridge"
@ -63,13 +64,13 @@ func (iface *lnInterface) init(c libnetwork.NetworkController, n libnetwork.Netw
defer close(iface.ready)
id := identity.NewID()
ep, err := n.CreateEndpoint(id)
ep, err := n.CreateEndpoint(id, libnetwork.CreateOptionDisableResolution())
if err != nil {
iface.err = err
return
}
sbx, err := c.NewSandbox(id)
sbx, err := c.NewSandbox(id, libnetwork.OptionUseExternalKey())
if err != nil {
iface.err = err
return
@ -100,10 +101,10 @@ func (iface *lnInterface) Set(s *specs.Spec) {
func (iface *lnInterface) Close() error {
<-iface.ready
err := iface.sbx.Delete()
if iface.err != nil {
// iface.err takes precedence over cleanup errors
return iface.err
}
return err
go func() {
if err := iface.sbx.Delete(); err != nil {
logrus.Errorf("failed to delete builder network sandbox: %v", err)
}
}()
return iface.err
}