Skip to content

Commit 3dc0e12

Browse files
committed
Override network mtu value
1 parent e831ea8 commit 3dc0e12

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

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

0 commit comments

Comments
 (0)