moby: Docker daemon MTU not used when creating a new bridge network

Description I configure the /etc/docker/daemon.json with the “mtu” parameter to 1450. Default bridge is ok with mtu=1450. But when a new bridge network is created (either docker network create or docker-compose), the mtu parameter is false. It’s always 1500.

Steps to reproduce the issue:

  1. Add "mtu": 1450 to /etc/docker/daemon.json
  2. Restart docker daemon
  3. Create a new bridge : docker network create my-net

Describe the results you received: my-net MTU = 1500

Describe the results you expected: my-net MTU = 1450

Output of docker version:

Client:
 Version:      17.06.2-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 20:00:17 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.2-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 19:59:11 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 4
 Running: 1
 Paused: 0
 Stopped: 3
Images: 41
Server Version: 17.06.2-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/100000.100000/aufs
 Backing Filesystem: extfs
 Dirs: 163
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
 userns
Kernel Version: 4.4.0-93-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 15.67GiB
Name: test-vm-04
ID: OZSP:AWLJ:HAPO:CZD6:NNLX:YDIT:LGWR:RMEI:P4SK:SBY4:2RAT:5YIK
Docker Root Dir: /var/lib/docker/100000.100000
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: true

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Maybe I’ll try again.

Can we set default configurations for network drivers when docker starts instead of asking the world to rewrite their recipe/compose file ?

Astonishing the number of easy fixes to improve way of life that are simply ignored for multiple years.

I think it’s not an openstack problem. If a host has a MTU < 1500, docker should detect the size and adapt the data packets.

@thaJeztah I’m ok with your remark but the problem is when you have an openstack environment, all networks should have a mtu=1450. I think if we can have an default option for MTU when we are created a network, it could be very appreciate. If default MTU change, a stop/start for the network without update the configuration should be better.

@thaJeztah I understand but when you use Openstack (for example) you have to put a custom MTU for each network you want to create. So you have to update all docker-compose files. And if openstack change the MTU, all your containers will be KO. So you have to update all your docker-compose and restart again. It’s difficult and dangerous in production environment.

So it would be useful to have an option to set the default MTU for all networks as right now using some else’s compose file doesn’t work without modifications.

Ok I understand the reasons but in this case, is it possible to add a parameter to configure by default all containers with a default MTU. Otherwise, we have to add it on each docker run or docker-compose ?

Auto-detecting MTU was removed at some point, because it would still be hit-and-miss, and cause issues in various situations; see https://github.com/moby/moby/pull/18108