Skip to content

Commit fd7b9d9

Browse files
aledbfkylos101
authored andcommitted
Override network mtu value
1 parent 8fdd45c commit fd7b9d9

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
@@ -41,6 +41,7 @@ import (
4141
"github.com/docker/go-connections/nat"
4242
"github.com/docker/go-units"
4343
"github.com/sirupsen/logrus"
44+
"github.com/vishvananda/netlink"
4445

4546
"github.com/compose-spec/compose-go/v2/types"
4647

@@ -1197,6 +1198,19 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
11971198
}
11981199
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11991200
}
1201+
1202+
// override MTU value and set custom MTU one.
1203+
// This is required for gitpod.io due to the veth change
1204+
// https://github.com/gitpod-io/gitpod/pull/8955
1205+
if createOpts.Options == nil {
1206+
createOpts.Options = make(map[string]string)
1207+
}
1208+
1209+
netIface, err := netlink.LinkByName("ceth0")
1210+
if err == nil {
1211+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1212+
}
1213+
12001214
networkEventName := fmt.Sprintf("Network %s", n.Name)
12011215
w := progress.ContextWriter(ctx)
12021216
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)