Troubleshooting September 23, 2026

Fix Docker Hub Timeouts With Clash: Troubleshoot Pull Errors

When docker pull keeps timing out, the cause may be Clash routing, DNS, or an unreliable proxy node rather than the image itself. Follow a clear checklist to test connectivity, route Docker Hub domains correctly, and restore reliable image pulls.

Docker Proxy GitHub Acceleration Advanced Config YAML

1. Scope, symptoms, and the first useful distinction

This guide is for developers who already run Clash Verge Rev, Clash Verge, or another Mihomo-compatible client and see Docker commands fail even though ordinary web browsing appears normal. The typical symptoms include docker pull hanging for several minutes, an image manifest request returning context deadline exceeded, an authentication request failing with net/http: request canceled, or a layer download stopping halfway through with an unexpected EOF.

A timeout does not automatically mean that Docker Hub is unavailable or that the image is broken. Docker performs several independent HTTPS operations: it resolves registry hostnames, contacts an authentication service, requests a manifest, and downloads multiple content-addressed layers from a content delivery network. Clash may route those destinations through different policies, while Docker itself may use a daemon environment that is separate from your browser and terminal.

The first goal is therefore not to add a large list of random domains. It is to identify which request fails, which process made it, and which Clash policy handled it. Once those three facts are known, the repair is usually a small routing, DNS, or proxy-environment change rather than a complete configuration rewrite.

A successful browser test proves only that one browser process can reach one URL. It does not prove that the Docker daemon can resolve, authenticate, and download every registry endpoint through the same path.

2. Understand Docker Hub’s multi-host traffic pattern

A Docker pull normally begins with a request to the registry API, commonly represented by registry-1.docker.io. If the registry requires authentication, Docker is directed to an authorization endpoint associated with Docker Hub, often under auth.docker.io. After the client receives a token, it requests the image manifest and then downloads blobs from storage or CDN hostnames. The final layer hostnames may not resemble the repository name that you typed in the command.

For example, a pull such as docker pull library/alpine:latest may involve the following logical sequence:

This explains why a command can authenticate successfully and still fail while downloading layers. It also explains why allowing only registry-1.docker.io may not be enough. Depending on the image, Docker Hub infrastructure, client version, and network region, the data path may include additional domains such as docker.io, docker.com, auth.docker.io, registry-1.docker.io, or CDN and object-storage names visible in verbose logs.

Do not treat every hostname that appears in a browser’s Docker Hub page as a registry endpoint. Marketing pages, analytics, account management, and image pulls are separate traffic surfaces. Start with the names observed by the Docker client, then add only the minimum rules needed for your workflow. This keeps your configuration easier to audit and prevents unrelated services from being sent through a slow relay.

3. Reproduce the failure outside the Docker UI

Before changing Clash rules, capture a repeatable failure. Use a small public image so that a private registry permission problem does not confuse the network diagnosis. Remove only the local image you are testing, then run the pull again with timestamps recorded. On Linux and macOS, the following commands are useful:

docker image rm alpine:latest 2>/dev/null || true
docker pull --progress=plain alpine:latest
docker version
docker info

The exact output differs between Docker Engine, Docker Desktop, and Podman-compatible environments, but the error wording still gives useful clues. A failure before any layer progress usually points toward DNS, authentication, or registry connectivity. A failure after the manifest is received often points toward a blob CDN, MTU issue, unstable node, or connection reuse problem.

Test DNS independently from the same host:

nslookup registry-1.docker.io
nslookup auth.docker.io
curl -I --connect-timeout 10 https://registry-1.docker.io/v2/

A healthy registry endpoint commonly returns an HTTP response such as 401 Unauthorized from the /v2/ request. That status is not necessarily a failure: it confirms that DNS, TCP, TLS, and the registry’s HTTP layer responded. A timeout, connection reset, or certificate error tells you to investigate the path before looking at image tags.

Run the same test with Clash temporarily disabled, then with Clash enabled but using a known stable node. This comparison is more valuable than testing five random nodes. If direct access fails and a proxy succeeds, routing is likely required. If direct access succeeds but a proxy fails, the selected relay, its DNS behavior, or its egress reputation may be the actual problem.

4. Read Clash logs instead of guessing at domains

Open the connection or request log in your Clash client while starting a fresh pull. In Clash Verge Rev, filter for terms such as docker, registry, auth, and the hostname shown by the Docker error. You are looking for three pieces of information: the requested domain, the selected rule, and the proxy group or final connection type.

A useful log sequence may look conceptually like this:

That sequence means the configuration is inconsistent, not necessarily that the entire Docker service is blocked. A broad rule such as GEOIP,CN,DIRECT or a final MATCH,DIRECT may capture a registry hostname before your intended Docker rule is evaluated. Mihomo rules are processed from top to bottom, so specific Docker entries must appear above broad country, IP, or catch-all rules.

Use a dedicated proxy group rather than sending Docker traffic into the same group used for video streaming. Image pulls create several parallel downloads and can expose a node’s bandwidth limit quickly. A group named something like Docker-Proxy makes it easier to test a low-latency relay, compare nodes, and switch back to direct access without editing every rule.

proxy-groups:
  - name: Docker-Proxy
    type: select
    proxies:
      - Node-A
      - Node-B
      - DIRECT

rules:
  - DOMAIN,auth.docker.io,Docker-Proxy
  - DOMAIN,registry-1.docker.io,Docker-Proxy
  - DOMAIN-SUFFIX,docker.io,Docker-Proxy
  - DOMAIN-SUFFIX,docker.com,Docker-Proxy
  - MATCH,DIRECT

This is a starting pattern, not a universal hostname list. Confirm the names in your logs before expanding it. If your environment uses a private registry, keep its internal domain above these rules and route it through the company VPN or DIRECT according to your organization’s network design.

5. Configure DNS carefully with fake-IP and redirection modes

DNS is one of the most common reasons a browser works while Docker fails. Clash may use fake-IP mode, redirection-host mode, or a mixed strategy. Fake-IP returns synthetic addresses to applications and later maps those addresses back to hostnames inside the proxy core. This can work well for ordinary clients, but a daemon, VM, container bridge, or security tool may treat the synthetic address differently from a normal browser.

Docker Desktop is especially important to identify because the Docker daemon may run inside a managed Linux virtual machine rather than directly in the host operating system. Your host browser can resolve registry-1.docker.io through Clash while the Docker VM uses its own resolver. On Linux, a systemd-managed Docker daemon may also inherit DNS and proxy settings from a service file rather than from your interactive shell.

Check what resolver the daemon can actually use. On Linux, inspect the host resolver and Docker’s daemon configuration:

cat /etc/resolv.conf
sudo systemctl show docker --property=Environment
sudo cat /etc/docker/daemon.json

Do not blindly place public DNS addresses into every field. A corporate network may require internal DNS for private registries, and a proxy provider’s recommended DNS may not be reachable directly. A safer approach is to make DNS behavior consistent with your chosen routing model: resolve proxy-bound domains through a resolver reachable by Clash, keep internal names on the internal resolver, and verify that the Docker runtime can reach the resolver it is configured to use.

If fake-IP mode causes a reproducible failure, test a controlled change rather than disabling every protection. Add the affected Docker domains to the fake-IP filter, switch those names to normal host resolution, or use a compatible redirection-host strategy for the Docker environment. After each change, restart the relevant Docker daemon or desktop application so stale DNS and connection pools do not obscure the result.

6. Align Docker’s proxy settings with Clash

Clash’s system proxy switch does not guarantee that the Docker daemon will use the proxy. GUI applications, shells, and background services each have different environment inheritance rules. A terminal may see HTTPS_PROXY while the system service does not. Docker Desktop may expose its own proxy controls, while Docker Engine on Linux commonly reads proxy settings from a systemd drop-in or daemon configuration.

For a command-line client test, you can temporarily export a local Clash mixed-port or HTTP proxy port, depending on your configuration:

export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
export ALL_PROXY=socks5://127.0.0.1:7891
docker pull alpine:latest

Use the correct port from your Clash client. An HTTP proxy port is not interchangeable with a SOCKS port, and a mixed port may accept both styles only if Mihomo is configured that way. If the test succeeds only after these variables are exported, you have found an environment propagation problem rather than a missing Docker domain rule.

For a Linux systemd service, create a drop-in instead of editing generated files:

sudo systemctl edit docker

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:7890"
Environment="HTTPS_PROXY=http://127.0.0.1:7890"
Environment="NO_PROXY=localhost,127.0.0.1,.internal.example.com"

sudo systemctl daemon-reload
sudo systemctl restart docker

The NO_PROXY list matters. If it is too broad, Docker may bypass Clash for public registry domains. If it is too narrow, private registries and local services may be sent to an external relay. Keep internal CIDRs, loopback addresses, and private registry suffixes there, but do not add .docker.io unless you intentionally want Docker Hub to bypass the proxy.

Docker Desktop users should check its application-level proxy settings and network mode separately. A host-level Clash system proxy switch may affect the desktop UI but not the VM that runs the daemon. Restart Docker Desktop after changing proxy settings and verify with a fresh pull rather than relying on an already-running container.

7. Compare nodes, MTU, and connection stability

If the correct Docker domains appear in Clash logs but large layers still fail, focus on transport quality. A node may handle small HTTPS requests yet drop long-lived or parallel downloads because of congestion, bandwidth limits, packet loss, or an unstable IPv6 route. Authentication can succeed in seconds while a several-hundred-megabyte layer exposes the weakness.

Compare at least two nodes using the same image and the same routing rules. Record time to receive the manifest, time to complete the first layer, and whether the failure occurs at a consistent percentage. A node that is slightly slower but completes every layer is more useful than one that has excellent latency and repeatedly resets large transfers.

MTU problems can produce confusing symptoms, particularly when Docker runs inside a VM, WSL2, a corporate tunnel, or a TUN interface. Do not lower MTU at random across the entire operating system. First compare a small request with a large pull, inspect whether only certain networks fail, and check the MTU values of the physical interface, Clash TUN interface, Docker bridge, and virtual machine adapter. Apply the smallest documented change, then retest.

HTTP/2 and connection reuse can also reveal node-specific problems. If one node repeatedly resets connections while another completes the pull, replacing the node is usually safer than adding increasingly broad routing exceptions. Keep the configuration simple enough that the next person can identify whether the failure is DNS, policy selection, proxy authentication, or transport quality.

8. Common fixes that make the problem harder

Do not enable global TUN mode as the first repair

TUN mode can capture traffic from applications that ignore system proxy variables, but it also changes DNS, routes, private-network access, and sometimes container connectivity. If Docker works only after enabling TUN, that is useful evidence, but it does not prove that global capture is the best permanent design. Identify the daemon’s actual network namespace and configure that boundary deliberately.

Do not copy an unverified domain list

A forum list may contain retired endpoints, unrelated account services, or a catch-all suffix that routes far more traffic than intended. Start with the logs from the failing pull. Add a hostname only when it appears in your environment or is required by documented registry behavior. This reduces accidental proxying of private services and makes future troubleshooting much faster.

Do not change DNS, rules, TUN, and node selection together

If four settings change at once and the next pull succeeds, you will not know which change mattered. Use a small experiment sequence: direct versus proxy, stable node versus alternate node, normal DNS versus fake-IP exception, then daemon proxy environment. Keep the previous configuration so you can revert after each test.

9. Frequently asked questions

Why does Docker Hub work in my browser but not with docker pull?

The browser and Docker may use different DNS resolvers, proxy settings, network namespaces, and authentication flows. Docker may also download layers from CDN hosts that the browser test never contacted. Check Docker’s own logs and daemon environment rather than treating browser access as a complete connectivity test.

Is a 401 response from registry-1.docker.io always an error?

No. A 401 response from the registry /v2/ endpoint often confirms that DNS, TCP, TLS, and HTTP connectivity are working. The registry is asking the client to obtain an authorization token. Investigate timeouts, failed token requests, or subsequent blob downloads instead of treating every 401 as a routing failure.

Should I disable fake-IP mode for Docker?

Not automatically. Fake-IP can work correctly when the Docker runtime and Clash core share a compatible DNS path. If logs show synthetic addresses, failed callbacks, or a Docker VM that cannot use Clash’s resolver, test a targeted fake-IP filter or redirection-host exception for the affected domains. Make one change at a time and restart the daemon before retesting.

Should Docker Hub use DIRECT or a proxy?

The answer depends on your network, organization policy, and the reliability of the available route. Use DIRECT when it is stable and permitted; use a dedicated, trustworthy proxy group when direct access is consistently interrupted. Avoid assuming that every proxy is better than the local route, because image downloads are sensitive to bandwidth, packet loss, and node stability.

Compared with single-purpose VPN clients that offer only an on-or-off tunnel, Clash gives you observable rules, selectable nodes, DNS controls, and separate handling for Docker Hub, private registries, and internal services. That makes it possible to keep a company registry on its required path while sending only failing public registry traffic through a tested relay. If you want the same controls across Windows, macOS, Linux, and Android, choose a Mihomo-compatible client and apply the routing method that matches your Docker environment rather than relying on a blind global switch.

Download Clash clients →

Ready to get started?

Use a Mihomo-compatible Clash client to inspect Docker routes, test nodes, and keep registry traffic predictable.