Skip to content

Commit 8eae1be

Browse files
aledbfkylos101
authored andcommitted
Override network mtu value
1 parent cd0fc21 commit 8eae1be

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

@@ -1158,6 +1159,19 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi
11581159
}
11591160
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11601161
}
1162+
1163+
// override MTU value and set custom MTU one.
1164+
// This is required for gitpod.io due to the veth change
1165+
// https://github.com/gitpod-io/gitpod/pull/8955
1166+
if createOpts.Options == nil {
1167+
createOpts.Options = make(map[string]string)
1168+
}
1169+
1170+
netIface, err := netlink.LinkByName("ceth0")
1171+
if err == nil {
1172+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1173+
}
1174+
11611175
networkEventName := fmt.Sprintf("Network %s", n.Name)
11621176
w := progress.ContextWriter(ctx)
11631177
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)