Docker lowers interface MTU with 50 less than connected network, why?

It seems that docker lowers the MTU on a network interface by itself with 50 less than set on the network you connect.

So:

  • If the network has an MTU of 1500, eth0 becomes 1450.
  • If you set it on 1450 (because your underlying network is encapsulated) eth0 gets an MTU of 1400

Why does this happen ? Is it because Docker encapsulates it’s own networks ?

docker should not touch the mtu of the host network interface itself.

update: cleaned up the the post, left the original blured after the updated response.

The mtu size of a plain docker container, started with docker run or docker compose/docker-compose should still have the same mtu size.

If you are talking about swarm services, started with docker service create or docker stack deploy using an overlay network, then of course the mtu size will be reduced by the 50 bytes overhead of vxlan. The overhead does not exist if the service uses a bridge network.

For containers in a bridge network, the mtu size will be the same as the host, unless you define another mtu when creating the network.

For contrainers in an overlay network, the mtu size will be reduced by 50 bytes overhead for vxlan.

My lab hosts have an mtu of 1500. Docker containers attached to a bridge network have an mtu 1500 for me. Swarm service task containers attached to an overlay network have an mtu of 1450 for me. A test Swarm service attached to a bridge network, still has mtu of 1500.