dockerd-rootless.sh
does not set proper MTU when manually specifying slirp4netns as NET
#47765
Labels
area/rootless
Rootless mode
kind/bug
Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
status/0-triage
Description
I just noticed that the MTU that my docker service is using in rootless-mode is only at
1500
, while I was sure that before it was at65520
. I investigated the issue and noticed that the rootless docker script,dockerd-rootless.sh
, only set's MTU to65520
if you DON'T specifyDOCKERD_ROOTLESS_ROOTLESSKIT_NET
.The thing is, the Docker docs clearly say that I should add the following systemd drop-in file to get proper source IP addresses in my containers:
But when I add the file above, the
DOCKERD_ROOTLESS_ROOTLESSKIT_NET
environment variable is set, which in turn makes thedockerd-rootless.sh
script SKIP theslirp4netns
and--netns-type
detection. This results indockerd-rootless.sh
using the default1500
MTU. When I remove theEnvironment="DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns"
line,dockerd-rootless.sh
set's a MTU of65520
.Due to the docs saying that I can increase the MTU to "improve performance", I believe that the
dockerd-rootless.sh
should properly detectDOCKERD_ROOTLESS_ROOTLESSKIT_NET
beingslirp4netns
and then setting the MTU to65520
when unset.I'm open to do a PR myself.
Reproduce
systemctl --user status docker
(should be at the top in the arguments of one of the processes ofrootlesskit
orslirp4netns
)~/.config/systemd/user/docker.service.d/override.conf
with the following contents:systemctl --user daemon-reload
andsystemctl --user restart docker
systemctl --user status docker
Expected behavior
slirp4netns
should use an MTU of65520
, even when manually specifyingDOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns
, but NOT when specifyingDOCKERD_ROOTLESS_ROOTLESSKIT_MTU
.docker version
Client: Docker Engine - Community Version: 26.1.0 API version: 1.45 Go version: go1.21.9 Git commit: 9714adc Built: Mon Apr 22 17:06:56 2024 OS/Arch: linux/amd64 Context: rootless Server: Docker Engine - Community Engine: Version: 26.1.0 API version: 1.45 (minimum version 1.24) Go version: go1.21.9 Git commit: c8af8eb Built: Mon Apr 22 17:06:56 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.31 GitCommit: e377cd56a71523140ca6ae87e30244719194a521 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0 rootlesskit: Version: 2.0.2 ApiVersion: 1.1.1 NetworkDriver: slirp4netns PortDriver: slirp4netns StateDir: /run/user/1000/dockerd-rootless slirp4netns: Version: 1.2.0 GitCommit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
docker info
Additional Info
(I have no idea what "MTU" actually does.)
Permalink for the code that needs adjustment in my opinion:
moby/contrib/dockerd-rootless.sh
Lines 78 to 101 in faf84d7
The git blame says @AkihiroSuda was responsible for this part of the
dockerd-rootless.sh
script, so I'll mention him here.The text was updated successfully, but these errors were encountered: