Skip to content

Commit ad053b9

Browse files
vschneiValentin Schneider-Lunitz
andauthored
add troubleshooting section for Docker MTU issues (#192)
* add troubleshooting section for Docker MTU issues Signed-off-by: Valentin Schneider-Lunitz <valentin.schneider-lunitz@charite.de> * improve clarity in Docker MTU troubleshooting section Signed-off-by: Valentin Schneider-Lunitz <valentin.schneider-lunitz@charite.de> --------- Signed-off-by: Valentin Schneider-Lunitz <valentin.schneider-lunitz@charite.de> Co-authored-by: Valentin Schneider-Lunitz <valentin.schneider-lunitz@charite.de>
1 parent 6e8110a commit ad053b9

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,53 @@ firefox http://localhost:8080/ga4gh/tes/v1/ui
125125
> **Note:** Host and port may differ if you have changed the configuration or
126126
> use an HTTP server to reroute calls to a different host.
127127
128+
## Docker MTU Troubleshooting
129+
130+
Sometimes containers cannot reach external hosts due to a mismatch between the
131+
container network Maximum Transmission Unit (MTU) and the host/network MTU
132+
(for example when the host interface or an overlay/VPN uses a lower MTU).
133+
This may cause TCP connections to hang or time out when packets exceed
134+
the path MTU and ICMP "fragmentation needed" messages are not delivered correctly.
135+
136+
Quick checks
137+
138+
- From the host: `ip link` to inspect MTU of the physical interface
139+
(e.g. `enp3s0`) and existing bridges (`br-...`).
140+
- From the container: verify connectivity with `curl` and check `/etc/resolv.conf`.
141+
- Capture ICMP messages on the host while reproducing the failure: e.g.
142+
`sudo tcpdump -n -i any host <container-ip> and icmp`.
143+
144+
Temporary verification
145+
146+
- Temporarily lower the container interface MTU (requires host access):
147+
148+
```bash
149+
PID=$(docker inspect -f '{{.State.Pid}}' <container>)
150+
sudo nsenter -t $PID -n ip link set dev eth0 mtu 1400
151+
```
152+
153+
If connectivity is restored after lowering the MTU, a PMTU mismatch is likely.
154+
155+
Permanent fixes
156+
157+
- Set Docker daemon MTU (global): edit `/etc/docker/daemon.json` and add
158+
`{"mtu": 1400}` then `sudo systemctl restart docker` and recreate networks.
159+
- Or set the compose network MTU for the project by adding to
160+
`docker-compose.yaml` under a top-level `networks.default.driver_opts`:
161+
162+
```yaml
163+
networks:
164+
default:
165+
driver: bridge
166+
driver_opts:
167+
com.docker.network.driver.mtu: "1400"
168+
```
169+
170+
After applying either change, recreate the compose stack so the bridge and
171+
veths are created with the new MTU and verify with `ip link` and a
172+
test `curl` from a container.
173+
174+
128175
## Contributing
129176

130177
This project is a community effort and lives off your contributions, be it in

0 commit comments

Comments
 (0)