Deploying Docker on domestic servers, after deployment, if the company doesn’t provide a registry center, the first thing developers need to do is configure a domestic registry mirror address. It’s lucky that today there was a server configured with a registry mirror address, but when pulling images, it kept failing to pull.
Error response from daemon: “https://registry-1.docker.io/v2/”: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Troubleshooting and Repair Attempts
Initially, we attempted to switch to alternative mirror acceleration addresses, hoping to resolve the issue. However, as expected, the problem persisted.
Subsequently, we began modifying the local DNS configuration in an attempt to find a breakthrough at the network resolution level. Unfortunately, after debugging, the fault remained.
At this point, the stability of the local network was heavily questioned, so we decisively switched to a mobile hotspot, attempting to bypass potential local network faults. However, the result was discouraging – there were no signs of improvement.
Problem Propagation
We currently have a few servers deployed domestically with Docker environments, and all of them failed to successfully pull the image. We initially hoped to find an alternative solution, but we found that they all consistently failed with identical error messages, indicating that the issue isn’t isolated to a single device.
Further investigation revealed that the image proxy seemingly malfunctioned instantaneously. In this critical moment, we quickly switched to a machine outside of the country, and thankfully, image pulls were restored at this location. This suggests that the problem is likely related to the domestic network links or associated configurations.
Strategy Adjustment: Circumventing the Issue
Given that direct image pulling methods within China have been heavily restricted, while foreign mirrors remain accessible, to expedite project progress, we’ve decided to employ a circumvention tactic. Initially, we switched to foreign servers to successfully pull the required images, subsequently pushing them to domestic mirror repositories to establish a “data bridge.”
At the same time, we synchronized modifications to the Dockerfile files, replacing image addresses with those adapted for the Chinese environment and then rebuilt the images, ultimately achieving successful deployment.