WSL: Rootless `docker` install failed: `ip_tables` not found in module dir
Windows Build Number
Microsoft Windows [Version 10.0.22000.194]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.10.55
Distro Version
Arch Linux (https://github.com/yuk7/ArchWSL)
Other Software
docker 1:20.10.8-1 (no Docker Desktop)
Repro Steps
- Install ArchWsl
- Install
docker - Configure rootless
docker(https://docs.docker.com/engine/security/rootless/) - [Optional] Configure
PATHenv variable - Run
dockerd-rootless-setuptool.sh install
Expected Behavior
Rootless docker install successfully.
Actual Behavior
> dockerd-rootless-setuptool.sh install
[ERROR] Missing system requirements. Run the following commands to
[ERROR] install the requirements and run this tool again.
[ERROR] Alternatively iptables checks can be disabled with --skip-iptables .
########## BEGIN ##########
sudo sh -eux <<EOF
# Load ip_tables module
modprobe ip_tables
EOF
########## END ##########
Diagnostic Logs
> modprobe ip_tables
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.10.55-xanmod1-microsoft-standard-WSL2
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 13
- Comments: 20
My steps:
logoutwsl shutdownubuntusudo systemctl disable --now docker.service docker.socketdockerd-rootless-setuptool.sh install --skip-iptablessudo nano /etc/resolv.confthen addnameserver 1.1.1.1and savelogoutwsl shutdowndocker run hello-worldTotal and Complete Solution
Finally! I’ve figured out the way to install rootless Docker with network working both when pull images and inside containers!
The Solution
iptablestoiptables-nftoriptables-legacy~/.local/bin/docker-network-setup.sh~/.config/systemd/user/docker-network-setup.service👇🏻Source For This Solution
This solution comes from another user’s iptables findings and my own findings. The core idea is change
iptablesto a usable one and match nameserver settings of docker’s and host’s.Same issues, using Ubuntu 22.04 in WSL2 (Windows 10)
Is there a workaround to this?
Edit: I have added a user to docker group to bypass this issue, but it’s not the most secure one. Waiting for a real fix
@shield02 I’m not aware of any way to install rootless Docker Desktop🤔 Currently, I’m using rootless Docker Engine + Portainer. Some information are even more detailed than Docker Desktop!
Hi @phamnhuvu-dev ! However, installing rootless Docker by installing Docker Engine and then make it rootless is just the procedure produces this issue. Due to the missing
iptablesmodule, and consequently installing Docker Engine without it, some easy jobs likeapt updatecan’t even execute. Personally, I’m using Docker Desktop as a workaround. But it’s rootful, so I really hope a rootless Docker on WSL coming soon.@timsu92 @shield02 Thank you guys, I re-checked the document, so if you want to set up docker rootless, there is only
Install Docker Engine on Ubuntuway can help. Docker Desktop is not rootless, but there are awesome features that Docker Destop supports you to set up a development environment, but don’t use it to expose a service to the internet to avoid security problems.But this installs Docker Desktop, which is a “rootful” Docker, not “rootless” Docker
EDIT: the original comment I was replying to is deleted
Seems that docker got the wrong DNS server address from WSL.
I’m using Ubuntu 22.04 on WSL2, and I see this in my
/etc/resolv.conf:Using the method described in Docker docs, I entered rootless Docker’s network namespace. From there, I see what Docker daemon sees when accessing the network by opening
/etc/resolv.conf:Oops! They aren’t the same!
A temporary fix for fetching images
This is a method that’s working only in current boot time. This procedure must be done overagain once rebooted. This solves Docker daemon’s network, but not container’s network.
I’m using rootless Docker installed by
dockerd-rootless-setuptool.sh install --skip-iptablessince it can’t find iptables module as well.nameserverline into the config. No privileged editor required.With steps described in https://github.com/microsoft/WSL/issues/7466#issuecomment-1488731997 the
docker run hello-worldcommand works for me.However, DNS does not work for me inside of a container. For example, if I run
docker run -it ubuntu bash, thenapt-get updatein the container, I get an errorTemporary failure resolving 'security.ubuntu.com'. These commands work normally when not running Docker in rootless mode.@phamnhuvu-dev , does DNS/networking work for you inside of a container?
Same issue using Debian 11 inside WSL2, using
dockerd-rootless-setuptool.sh install --skip-iptablesresulted in no error, but still couldn’t run docker without using sudo…