docker pull cannot reach registry-1.docker.io (no such host or request canceled)
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such hostShort answer
These errors mean the Docker daemon, not your shell, could not open a connection to Docker Hub. First test the registry address with curl from the same machine. If it hangs or fails, either a firewall blocks the Docker Hub domains, or the daemon sits behind a proxy it was never told about.
Fix it fast
1Find out which cause you have
Ask the registry endpoint directly from the same machine. Any HTTP answer means the network path works; a hang, a DNS failure or a reset means the connection is blocked before Docker is involved.
curl -sS -I --max-time 15 https://registry-1.docker.io/v2/2Match what you see, then jump to its fix
- 1
curl to registry-1.docker.io fails, or works while the pull still stalls on another hostA firewall or filter blocks one of the Docker Hub domainsFix - 2
Browsers and curl with proxy variables work, but docker pull times out or reports request canceledThe network needs a proxy and the daemon does not know about itFix
- 1
What does the error look like?
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such hostError response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled
Cause 1 of 2
A firewall or filter blocks one of the Docker Hub domains
1Check
A pull talks to more than one host: the registry, the authentication service and the content download host. A filter that allows only one of them breaks the pull. Test each one.
curl -sS -I --max-time 15 https://registry-1.docker.io
curl -sS -I --max-time 15 https://auth.docker.io
curl -sS -I --max-time 15 https://production.cloudfront.docker.com2Fix
Ask whoever runs the firewall, DNS filter or VPN to allow registry-1.docker.io, auth.docker.io, production.cloudfront.docker.com and hub.docker.com. Docker lists these as the domains Docker Desktop needs to pull and push images.
# allow these hosts on port 443
registry-1.docker.io
auth.docker.io
production.cloudfront.docker.com
hub.docker.com3Verify
Pull a small image again.
docker pull hello-worldConfirmed by docs.docker.com
Cause 2 of 2
The network needs a proxy and the daemon does not know about it
1Check
The daemon makes the registry connections, so a proxy exported in your shell does not help it. Check whether the daemon has a proxy at all.
env | grep -i proxy
systemctl show --property=Environment docker2Fix
On Linux, give the daemon the proxy in a systemd drop-in, then reload and restart Docker. Add the hosts that must skip the proxy (an internal registry, for example) to NO_PROXY. On Docker Desktop, set the proxy in its settings instead, because it ignores proxy entries in daemon.json.
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<'CONF'
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:3128"
CONF
sudo systemctl daemon-reload
sudo systemctl restart docker3Verify
Confirm the daemon picked up the variable, then pull again.
systemctl show --property=Environment docker
docker pull hello-worldConfirmed by docs.docker.com
How do I stop it coming back?
- Keep the four Docker Hub domains in the allow list of any corporate firewall or DNS filter you use.
- Put the proxy in the daemon configuration, not only in your shell profile, and write it down next to the server's setup notes.
- Test curl against the registry before blaming Docker after a network or VPN change.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
sam local fails: Running AWS SAM projects locally requires Docker
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
sam local start-api and sam local invoke run your function inside a Docker container, so SAM stops if it cannot talk to Docker.
3 causes, each with a fixServers
dnf fails to download repo metadata in a CentOS 8 Docker build
The same Dockerfile built fine before 2022
CentOS Linux 8 reached end of life on 31 December 2021 and its content left the mirrors.
2 causes, each with a fixServers
pip install confluent-kafka fails because librdkafka/rdkafka.h is missing
pip stops while building confluent-kafka from source
The error means pip is compiling confluent-kafka from source, and the compiler cannot find the librdkafka C headers.
3 causes, each with a fixServers
Cypress says the npm package is installed but the binary is missing
Cypress binary is missing after npm install in CI or in a Docker build
The npm package is only a launcher.
3 causes, each with a fixServers
A dev container port does not open in the browser when Docker runs on a remote host
If your application only accepts calls from localhost, it will reject connections from published ports
Three things usually break it: the app listens only on localhost inside the container, so published ports are rejected; you open the container port instead of the mapped localhost port VS Code shows; or you changed appPort or a Compose ports list and did not rebuild.
3 causes, each with a fix