Skip to content

Commit 8a48e68

Browse files
aledbfnandajavarma
authored andcommitted
Override network mtu value
1 parent b929810 commit 8a48e68

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/compose/create.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/docker/go-connections/nat"
4040
"github.com/docker/go-units"
4141
"github.com/sirupsen/logrus"
42+
"github.com/vishvananda/netlink"
4243

4344
"github.com/compose-spec/compose-go/types"
4445

@@ -1103,6 +1104,19 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
11031104
}
11041105
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11051106
}
1107+
1108+
// override MTU value and set custom MTU one.
1109+
// This is required for gitpod.io due to the veth change
1110+
// https://github.com/gitpod-io/gitpod/pull/8955
1111+
if createOpts.Options == nil {
1112+
createOpts.Options = make(map[string]string)
1113+
}
1114+
1115+
netIface, err := netlink.LinkByName("ceth0")
1116+
if err == nil {
1117+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1118+
}
1119+
11061120
networkEventName := fmt.Sprintf("Network %s", n.Name)
11071121
w := progress.ContextWriter(ctx)
11081122
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)