Skip to content

Commit 7974f5b

Browse files
aledbfkylos101
authored andcommitted
Override network mtu value
1 parent 8318f66 commit 7974f5b

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

@@ -1167,6 +1168,19 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
11671168
}
11681169
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11691170
}
1171+
1172+
// override MTU value and set custom MTU one.
1173+
// This is required for gitpod.io due to the veth change
1174+
// https://github.com/gitpod-io/gitpod/pull/8955
1175+
if createOpts.Options == nil {
1176+
createOpts.Options = make(map[string]string)
1177+
}
1178+
1179+
netIface, err := netlink.LinkByName("ceth0")
1180+
if err == nil {
1181+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1182+
}
1183+
11701184
networkEventName := fmt.Sprintf("Network %s", n.Name)
11711185
w := progress.ContextWriter(ctx)
11721186
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)