Skip to content

Commit 9046ba6

Browse files
aledbfWVerlaek
authored andcommitted
Override network mtu value
1 parent d6f842b commit 9046ba6

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
@@ -40,6 +40,7 @@ import (
4040
"github.com/docker/go-units"
4141
"github.com/pkg/errors"
4242
"github.com/sirupsen/logrus"
43+
"github.com/vishvananda/netlink"
4344

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

@@ -1175,6 +1176,19 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
11751176
}
11761177
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11771178
}
1179+
1180+
// override MTU value and set custom MTU one.
1181+
// This is required for gitpod.io due to the veth change
1182+
// https://github.com/gitpod-io/gitpod/pull/8955
1183+
if createOpts.Options == nil {
1184+
createOpts.Options = make(map[string]string)
1185+
}
1186+
1187+
netIface, err := netlink.LinkByName("ceth0")
1188+
if err == nil {
1189+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1190+
}
1191+
11781192
networkEventName := fmt.Sprintf("Network %s", n.Name)
11791193
w := progress.ContextWriter(ctx)
11801194
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)