rootless-containers / slirp4netns

User-mode networking for unprivileged network namespaces
GNU General Public License v2.0
715 stars 82 forks source link

Cannot pull images with rootless docker on openSUSE Tumbleweed #329

Closed tilfischer closed 9 months ago

tilfischer commented 9 months ago

Dear all,

recently, I faced a strange issue with rootless docker on openSUSE Tumbleweed, which prevented any pulling of images. Basically, no traffic seems to be leaving the rootlesskit's namespace. Pulling an docker images always gives an i/o timeout:

someuser@somehost:~> docker pull hello-world
Using default tag: latest
Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp: lookup registry-1.docker.io on 10.0.2.3:53: read udp 10.0.2.100:48971->10.0.2.3:53: i/o timeout

After quiet some digging and and with the help of two users at the docker forum and openSUSE forum, the issue seems to be connected to slirp4netns:

Following the slirp4netns documentation:

Requires /etc/resolv.conf not to be a symlink to a file outside /etc and /run.

However, in openSUSE the resolve.conf is generated in /var/run/netconfig/ from what is given in /etc/sysconfig/network/config and the first is symlinked to /etc/resolve.conf. Removing the simlinked /etc/resolve.conf solved the issue, but should not survive any restart of the sever:

someuser@somehost:~> docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
719385e32844: Pull complete 
Digest: sha256:4f53e2564790c8e7856ec08e384732aa38dc43c52f02952483e3f003afbf23db
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

Best

AkihiroSuda commented 9 months ago

Thanks for reporting. Was it working before? Was something changed on tumbleweed recently?

Adding some path (/var/run ?) to --copy-up helps? https://github.com/moby/moby/blob/591c98cdbee73d36fe27abdb4456f8d70b8e549d/contrib/dockerd-rootless.sh#L107

You may need DOCKERD_ROOTLESS_ROOTLESSKIT_SLIRP4NETNS_SANDBOX=false too https://github.com/moby/moby/blob/591c98cdbee73d36fe27abdb4456f8d70b8e549d/contrib/dockerd-rootless.sh#L15C2-L15C2

tilfischer commented 9 months ago

Thank for your reply!

I added --copy-up=/var/run to the line mentioned and uninstalled and installed rootless docker. However, this did not help.

What I have found out so far, is that netconfig was changed about a year ago, so that it does now use /run/netconfig instead of /var/run/netconfig.

Copying /var/run/netconfig/resolv.conf (or /run/netconfig/resolv.conf) to /etc or adding a symlink there for /run/netconfig/resolv.conf to /etc/resolv.conf works fine. However, with a symlink to /var/run/netconfig/resol.conf, no traffic can leave the namespace of the rootless docker.

Hence, that seems not be an issue for slirp4netns and I will close this issue.