109 lines
2.1 KiB
Markdown
109 lines
2.1 KiB
Markdown
# 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
|
|
```bash
|
|
./quick-dns-fix.sh
|
|
```
|
|
|
|
### Option 2: Manual DNS Fix
|
|
```bash
|
|
# 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:
|
|
1. Open Docker Desktop
|
|
2. Go to **Settings** → **Docker Engine**
|
|
3. Add DNS configuration:
|
|
```json
|
|
{
|
|
"dns": ["8.8.8.8", "8.8.4.4", "1.1.1.1"]
|
|
}
|
|
```
|
|
4. Click **Apply & Restart**
|
|
|
|
## Full Fix (If Quick Fix Doesn't Work)
|
|
|
|
Run the comprehensive fix script:
|
|
```bash
|
|
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):
|
|
```powershell
|
|
wsl --shutdown
|
|
```
|
|
Then restart your WSL terminal.
|
|
|
|
### Check Network Connectivity
|
|
```bash
|
|
# Test basic connectivity
|
|
ping 8.8.8.8
|
|
|
|
# Test DNS resolution
|
|
nslookup registry-1.docker.io
|
|
host registry-1.docker.io
|
|
```
|
|
|
|
### Check Docker Status
|
|
```bash
|
|
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:
|
|
```bash
|
|
cd /home/intlc/projects/quorum-test-network
|
|
./run.sh
|
|
```
|
|
|
|
## Prevention
|
|
|
|
To prevent WSL2 from overwriting `/etc/resolv.conf`:
|
|
```bash
|
|
sudo bash -c 'cat > /etc/wsl.conf <<EOF
|
|
[network]
|
|
generateResolvConf = false
|
|
EOF'
|
|
```
|
|
|
|
Then manually configure `/etc/resolv.conf` as shown above.
|
|
|