Quick Summary: The error
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: TLS handshake timeoutoccurs when the Docker daemon establishes a TCP connection to a container registry (like Docker Hub) but fails to complete the TLS/SSL negotiation within Go’s default 10-second timeout. Common causes include broken IPv6 routing, MTU packet fragmentation over VPNs, missing HTTP/HTTPS proxy configuration for the daemon, or high network latency.
Understanding the Root Causes
Unlike DNS resolution failures (no such host), a TLS handshake timeout indicates that the hostname resolved and TCP packets reached the registry, but the TLS ClientHello/ServerHello exchange stalled. In Linux, macOS, and Windows Docker environments, this typically stems from:
- Broken IPv6 Connectivity: Docker attempts to connect over IPv6 first when a registry returns AAAA records; if your host or ISP lacks a working IPv6 default route, the TLS handshake hangs until it times out.
- MTU Mismatch Over VPNs or PPPoE: Corporate VPNs (WireGuard, OpenVPN, Cisco AnyConnect) reduce the effective Maximum Transmission Unit (MTU) below 1500 bytes, causing large TLS certificate packets to drop silently during Path MTU Discovery.
- Unconfigured Daemon Proxy Settings: Setting
HTTPS_PROXYin your user shell does not automatically configure the backgrounddockerdsystemd service. - Parallel Layer Download Congestion: Docker’s default concurrency pulling too many layers simultaneously over a constrained network link.
Step 1: Quick Triage – Test Connectivity and Reduce Pull Concurrency
First, verify whether your host can complete a TLS handshake directly with curl, and lower Docker’s simultaneous download limit if your connection is congested:
# 1. Test direct TLS handshake speed to Docker Hub via IPv4 vs IPv6
curl -4 -Iv https://registry-1.docker.io/v2/
curl -6 -Iv https://registry-1.docker.io/v2/
# 2. If IPv4 succeeds rapidly while IPv6 hangs, IPv6 routing is broken on your host.
# 3. Also test lowering max-concurrent-downloads in /etc/docker/daemon.json:
sudo nano /etc/docker/daemon.json
# Add:
{
"max-concurrent-downloads": 2
}
Step 2: Fix MTU Fragmentation and Broken IPv6 Routing
If you are connected to a VPN or notice that curl -4 works while Docker hangs, lower Docker’s bridge MTU (e.g., to 1400 or 1280) and disable broken IPv6 on the host or Docker daemon:
# 1. Configure MTU and registry mirror in /etc/docker/daemon.json
sudo tee /etc/docker/daemon.json <<EOF
{
"mtu": 1400,
"max-concurrent-downloads": 2,
"registry-mirrors": ["https://mirror.gcr.io"]
}
EOF
# 2. If curl -6 hung earlier, temporarily disable IPv6 on Linux to test
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
# 3. Restart the Docker daemon
sudo systemctl restart docker
On Docker Desktop (macOS/Windows), open Settings → Docker Engine, paste the JSON block above, and click Apply & Restart.
Step 3: Configure Systemd Proxy Settings for dockerd
If your network requires an HTTP/HTTPS proxy to reach the internet, configure it directly on the Docker systemd unit rather than only in ~/.bashrc:
# 1. Create a systemd drop-in directory for the Docker service
sudo mkdir -p /etc/systemd/system/docker.service.d
# 2. Add your proxy environment variables
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:8080"
Environment="HTTPS_PROXY=http://proxy.example.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.local"
EOF
# 3. Reload systemd and restart Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
Verification & Testing Steps
Confirm that the Docker daemon picks up the updated network configuration and successfully pulls an image:
# 1. Verify active proxy or MTU settings recognized by Docker
docker info | grep -E "Proxy|Registry Mirrors|MTU"
# 2. Test pulling a lightweight image from Docker Hub
docker pull alpine:latest
# 3. Run a quick container check
docker run --rm alpine:latest echo "Registry TLS handshake succeeded!"
Troubleshooting Summary Comparison
| Symptom / Scenario | Primary Root Cause | Recommended Solution |
|---|---|---|
curl -4 works, curl -6 hangs |
Broken IPv6 route to Docker Hub | Disable IPv6 via sysctl or prefer IPv4 in network settings |
| Fails only while connected to VPN | TLS packet fragmentation due to MTU > VPN MTU | Set "mtu": 1400 (or 1280) in daemon.json |
| Corporate network behind proxy | dockerd ignores shell HTTPS_PROXY variables |
Add proxy env vars in docker.service.d/http-proxy.conf |
| Slow Wi-Fi or throttled link | Too many parallel TLS layer downloads | Set "max-concurrent-downloads": 2 and use a mirror |
Leave a Reply