Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

docker pull cannot reach registry-1.docker.io (no such host or request canceled)

ErrorError 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 host

Short 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.

  • Applies to Docker Engine 28, Docker Desktop 4, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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/
  2. 2Match what you see, then jump to its fix

    1. 1curl 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. 2Browsers 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

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 host
  • Error 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.com

2Fix

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.com

3Verify

Pull a small image again.

docker pull hello-world

Confirmed by docs.docker.com

Did this fix it?

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 docker

2Fix

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 docker

3Verify

Confirm the daemon picked up the variable, then pull again.

systemctl show --property=Environment docker
docker pull hello-world

Confirmed by docs.docker.com

Did this fix it?

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

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

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.