DEV Community

Discussion on: Install Docker on Windows (WSL) without Docker Desktop

 
timblaktu profile image
Tim Black • Edited

Still same error after switching explicitly to iptables-legacy in debian 11. FWIW, I'm also passing the following dns servers to my containers via docker daemon.json:

# This one is the WSL net interface as seen by windows. It cannot be pinged from container.
nameserver 172.29.224.1
nameserver 1.1.1.1
nameserver 8.8.8.8
Enter fullscreen mode Exit fullscreen mode

I've tried putting the google and cloudflare dns first in this order, to no avail.

Thread Thread
 
timblaktu profile image
Tim Black

The issue is more easily reproduced on my system by just running ping commands inside the latest alpine image:

$> home/tim/src > docker run --rm -it alpine ping -c4 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
timblaktu profile image
Tim Black

The problem was that even though I had reverted to iptables-legacy in Debian, I still had iptables: "false" in my docker daemon.json. On removing that, docker can use its default iptables impl and work with Debian Bullseye. Now, my containers can access "the internet".

I realize that your post indicated to use iptables: false as a way to get debian wsl2 instances to work with docker. But that never worked for me for some reason.

Thread Thread
 
bowmanjd profile image
Jonathan Bowman

Yeah, I have actually changed the instructions, removing the iptables:false, as using iptables-legacy seems like the right way to do it.

Thread Thread
 
philippthiele profile image
philippthiele • Edited

I had the same issue with Ubuntu in WSL2. Removing iptables: "false" from the daemon.json and switching to iptables-legacy did the trick. No full reboot was necessary, running "wsl --shutdown" in powershell + reopening the ubuntu shell did the trick. Thanks!