Modifying MTU of docker network

Hi!

In a project we’re working on I noticed that some devices using cellular sometimes end up with an MTU of e.g 1430 instead of 1500. Which I assume is normal and that the MTU is automatically detected.

An issue arised with this, my containers can not make any network requests with SSL.
I can see that my bridge network has an MTU of 1500 and when our cellular (or any) network interface does not match that MTU no SSL traffic works.

I have to admit, I am not very well knowledgable when it comes to this topic but from what I can gather given that the cellular connection has an MTU which can fluctuate, and to avoid hacking something together such as adjusting the MTU of the docker bridge interfaces there must be a way to statically define the MTU for the docker networks?

If I modify the MTU (1430 → 1500) of my cellular connection I instead get a much less stable connection, but it works to some extent.

Surely I can’t be the first to come across this issue, but I’ve been unable to find a good solution.

I’ve attempted the following (defining a lower MTU across the board):
But results in the supervisor continiously logging “Creating container network”, making me suspect these fields are not supported by Balena?

networks:
  container_network:
    driver: bridge
    driver_opts:
      com.docker.network.driver.mtu: 1430
    ipam:
      driver: default
      config:
        - subnet: 'X.X.X.X'
          gateway: 'X.X.X.X'

Hi, the driver_opts might have the wrong format. Try:

networks:                                
  default:                               
    driver: bridge                       
    driver_opts:                         
      com.docker.network.driver.mtu: '1430'

Mind the quotes around 1430.

1 Like