To solve the problem, you need to configure the Docker daemon in such a way that the virtual network card of newly created containers gets an MTU that is smaller than or equal to that of the outgoing network card. For this purpose create the file /etc/docker/daemon. If the outgoing interface (in this case ens3) has an MTU smaller than 1500, some action is required. If it is greater than or equal to 1500, this problem does not apply to you. Link/ether uu:vv:ww:xx:yy:zz brd ff:ff:ff:ff:ff:ff Link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ffģ: docker0: mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default Step 2: Let’s try to access nginx on port 80 from the localhost. Link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00Ģ: ens3: mtu 1454 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 Step 1: First thing first, let’s create a container using the Docker image named ‘nginx:alpine’ as shown below: Explanation: In the above example, we have created a container ‘mynginx’ and attached the host network. With the command ip link you can display the locally configured network cards and their MTU: 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 Therefore, the value of the Docker MTU is set to 1500. The Docker Daemon does not check the MTU of the outgoing connection at startup. Docker MTU configurationĪ common problem when operating dockers within a virtualization infrastructure is that the network cards provided to virtual machines do not have the default MTU of 1500. This is often the case, for example, when working in a cloud infrastructure (e.g.
If you want to use Docker on servers or virtual machines, technical limitations can sometimes lead to a situation in which – even without intentional limitation – it is not possible to access the outer world from a docker container.