Skip to content

Commit 951f853

Browse files
aledbfkylos101
authored andcommitted
Override network mtu value
1 parent c665c53 commit 951f853

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-connections/nat"
4141
"github.com/docker/go-units"
4242
"github.com/sirupsen/logrus"
43+
"github.com/vishvananda/netlink"
4344

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

@@ -1129,6 +1130,19 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, n *types.Ne
11291130
}
11301131
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11311132
}
1133+
1134+
// override MTU value and set custom MTU one.
1135+
// This is required for gitpod.io due to the veth change
1136+
// https://github.com/gitpod-io/gitpod/pull/8955
1137+
if createOpts.Options == nil {
1138+
createOpts.Options = make(map[string]string)
1139+
}
1140+
1141+
netIface, err := netlink.LinkByName("ceth0")
1142+
if err == nil {
1143+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1144+
}
1145+
11321146
networkEventName := fmt.Sprintf("Network %s", n.Name)
11331147
w := progress.ContextWriter(ctx)
11341148
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)