Skip to content

Commit 80b2e95

Browse files
aledbfFuristo
authored andcommitted
Override network mtu value
1 parent 7b0ed13 commit 80b2e95

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

@@ -1152,6 +1153,19 @@ func (s *composeService) ensureNetwork(ctx context.Context, n types.NetworkConfi
11521153
}
11531154
createOpts.IPAM.Config = append(createOpts.IPAM.Config, config)
11541155
}
1156+
1157+
// override MTU value and set custom MTU one.
1158+
// This is required for gitpod.io due to the veth change
1159+
// https://github.com/gitpod-io/gitpod/pull/8955
1160+
if createOpts.Options == nil {
1161+
createOpts.Options = make(map[string]string)
1162+
}
1163+
1164+
netIface, err := netlink.LinkByName("ceth0")
1165+
if err == nil {
1166+
createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU)
1167+
}
1168+
11551169
networkEventName := fmt.Sprintf("Network %s", n.Name)
11561170
w := progress.ContextWriter(ctx)
11571171
w.Event(progress.CreatingEvent(networkEventName))

0 commit comments

Comments
 (0)