2.1 KiB
2.1 KiB
Docker DNS Fix for WSL2
Problem
Docker is failing to pull images with the error:
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:32836->10.0.2.3:53: i/o timeout
This is a DNS resolution issue in WSL2.
Quick Fix (Try This First)
Option 1: Quick Script
./quick-dns-fix.sh
Option 2: Manual DNS Fix
# Fix WSL2 DNS (requires sudo)
sudo bash -c 'cat > /etc/resolv.conf <<EOF
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
EOF'
# Test DNS
nslookup registry-1.docker.io
Option 3: Docker Desktop Configuration
If using Docker Desktop:
- Open Docker Desktop
- Go to Settings → Docker Engine
- Add DNS configuration:
{
"dns": ["8.8.8.8", "8.8.4.4", "1.1.1.1"]
}
- Click Apply & Restart
Full Fix (If Quick Fix Doesn't Work)
Run the comprehensive fix script:
sudo ./fix-docker-dns.sh
This script will:
- Configure WSL2 DNS settings
- Configure Docker daemon DNS
- Restart Docker service
- Test connectivity
Additional Troubleshooting
Restart WSL
From Windows PowerShell (as Administrator):
wsl --shutdown
Then restart your WSL terminal.
Check Network Connectivity
# Test basic connectivity
ping 8.8.8.8
# Test DNS resolution
nslookup registry-1.docker.io
host registry-1.docker.io
Check Docker Status
docker info
docker version
Windows Firewall/Antivirus
- Check if Windows Firewall is blocking Docker
- Temporarily disable antivirus to test
- Add Docker Desktop to firewall exceptions
Alternative: Use Docker Mirror/Proxy
If you're behind a corporate firewall, you may need to configure a Docker registry mirror or proxy.
After Fixing
Once DNS is working, try running the Quorum network again:
cd /home/intlc/projects/quorum-test-network
./run.sh
Prevention
To prevent WSL2 from overwriting /etc/resolv.conf:
sudo bash -c 'cat > /etc/wsl.conf <<EOF
[network]
generateResolvConf = false
EOF'
Then manually configure /etc/resolv.conf as shown above.