Set custom MTU for Docker containers

If you have a custom MTU set on the upstream network interface on your host machine, you also need to configure a custom MTU on your Fleio network containers. Otherwise, networking will not work correctly.

You can test with the following commands if networking is working correctly from within Fleio utils container:

fleio bash
curl https://google.com

The curl command above fails when there is a Docker networking error. If network is working correctly, you should see few lines of HTML code, otherwise you get an error.

The default networking MTU is 1500. If you’re not sure if you have a lower MTU, run this command on the host where you have Fleio installed:

ip link show
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:15:5d:e5:44:77 brd ff:ff:ff:ff:ff:ff
...

This will list network interfaces. Your upstream interface may be named eth0 or ens3 etc. The MTU value will be displayed on its line, mtu 1400 in the example above. Ignore Docker related interfaces, names that start with veth... or br-....

Once you know that you have a lower than standard 1500 MTU on host, you need to configure Docker containers with the same value.

Edit file /home/fleio/compose/docker-compose.override.yml and add the following content

networks:
  backend:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 1400

To apply changes, run:

fleio recreate

The curl command should succeed now:

fleio bash
curl https://google.com