Intro
Docker Registry is the standard way to store and distribute container images. When networking between your Docker client, daemon, and registry fails, image pushes and pulls stop, blocking developers and deployments. Issues can stem from DNS resolution, incorrect ports, routing problems, firewalls, or TLS misconfigurations. Without a systematic approach, troubleshooting can become guesswork.
This guide provides a practical, vendor-neutral methodology to diagnose and fix Docker Registry networking problems. You will learn how to inventory your environment, safely test configuration changes, verify connectivity with concrete commands, and recover from failures. Each step includes real command examples and expected outputs, so you can follow along and build confidence. By the end, you will have a repeatable checklist to keep your registry traffic flowing.
Version and Environment Inventory
Before changing anything, document your setup. Knowing exact versions and network topology prevents chasing red herrings. Gather:
- Docker client version:
docker version --format '{{.Client.Version}}' - Docker daemon version:
docker version --format '{{.Server.Version}}'(if accessible) - Registry version: Often visible at
https://<registry>/v2/in headers or viadocker-registry --versionif you operate it. - Operating systems of client, daemon host, and registry host.
- Network path: Are client and registry on same host, same LAN, or across internet? Is a proxy or VPN involved?
- DNS resolution: Which DNS servers are used?
/etc/resolv.confon Linux oripconfig /allon Windows. - Firewall rules: Any local or network firewalls that might block port 5000 (default registry port) or 443 (common for TLS).
Example inventory command:
docker version
Expected output snippet:
Client: Docker Engine - Community
Version: 24.0.5
API version: 1.43
Go version: go1.20.4
Git commit: ced0996
Built: Fri Jul 21 00:00:00 2023
OS/Arch: linux/amd64
Server: Docker Engine - Community
Engine:
Version: 24.0.5
API version: 1.43 (minimum version 1.12)
Go version: go1.20.4
Git commit: a61e2b4
Built: Fri Jul 21 00:00:00 2023
OS/Arch: linux/amd64
Experimental: false
Record all details. If you use a registry service like Docker Hub, note the region and any mirror configuration (e.g., /etc/docker/daemon.json registry-mirrors).
Safe Configuration Path
When diagnosing, make one change at a time and test. Avoid broad modifications that could disrupt other services. Use a scoped approach:
- Isolate the failure point: Determine whether the issue is on the client side (e.g., Docker daemon config) or the network path.
- Test against a known-good endpoint: If possible, try pulling a small public image from Docker Hub to verify client functionality.
- Use a temporary configuration: Instead of editing
/etc/docker/daemon.jsondirectly, test with command-line flags that override settings. For example, use--registry-mirroron a one-off daemon process. - Back up configs: Before editing files like
daemon.jsonor/etc/hosts, create a timestamped backup.
Example: Temporarily setting a registry mirror for a test daemon:
sudo dockerd --registry-mirror=https://mirror.example.com --debug
Expected: The daemon starts with debug logging, and you can observe registry connections in the terminal output.
If you need to change DNS resolution for a specific host, test with a modified /etc/hosts entry before changing DNS servers globally.
Common Failure Modes and Root Causes
Many issues fall into a few categories. Knowing symptoms speeds diagnosis.
| Symptom | Likely Cause | Quick Check |
|---|---|---|
docker pull hangs then times out | Firewall blocking port 5000 or 443 | telnet <registry> 5000 or nc -zv <registry> 5000 |
Get https://registry.example.com/v2/: dial tcp: lookup registry.example.com: no such host | DNS resolution failure | nslookup registry.example.com |
x509: certificate signed by unknown authority | Self-signed cert not trusted or wrong hostname in cert | openssl s_client -connect <registry>:443 |
denied: requested access to the resource is denied | Authentication issue (often after proxy change) | docker login <registry> |
| connection refused | Registry not running or listening on different port | docker logs or ss -tulpn | grep 5000 |
| no route to host | Routing problem or firewall on intermediate hop | ip route get |
DNS Issues
DNS can cause intermittent failures. Verify:
nslookup registry.example.com
Expected if correct:
Server: 192.168.1.1
Address: 192.168.1.1#53
Name: registry.example.com
Address: 10.0.0.5
If no address, check /etc/hosts, DNS server config, or domain delegation.
Port and Firewall Issues
Default registry port is 5000 (HTTP) or 443 (HTTPS). Many firewalls block non-standard ports. Use telnet or nc to test connectivity:
nc -zv registry.example.com 5000
Expected if open:
Connection to registry.example.com 5000 port [tcp/*] succeeded!
If it fails, check security groups, iptables, or cloud provider firewall rules.
TLS and Certificate Issues
If your registry uses HTTPS, a certificate mismatch stops connections. Inspect certificate:
openssl s_client -connect registry.example.com:443 -servername registry.example.com | openssl x509 -noout -subject -dates
Verify the certificate's CN or SAN matches the hostname you use.
Verification and Diagnostics
Here is a step-by-step diagnostic flow with commands and expected outputs.
Step 1: Check Docker daemon connectivity
Run docker info to see if daemon is reachable:
docker info --format '{{.ServerVersion}}'
Expected:
24.0.5
Step 2: Attempt a small pull
Try pulling a tiny image like hello-world from Docker Hub to rule out client issues:
docker pull hello-world
Expected on success:
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:...
Status: Image is up to date for hello-world: latest
docker.io/library/hello-world: latest
Step 3: Test registry API with curl
Use curl to call the registry's version endpoint:
curl -v https://registry.example.com/v2/
Expected output (if authentication required, expect 401 but connection established):
* Trying 10.0.0.5:443...
* Connected to registry.example.com (10.0.0.5) port 443 (#0)
...
< HTTP/2 401
< content-type: application/json
...
If connection fails, note the error: DNS, refused, timeout, TLS.
Step 4: Test with docker login
For private registries, valid credentials are required:
docker login registry.example.com
Expected success:
Login Succeeded
Step 5: Perform a scoped push/pull to a test repo
Tag a small local image and push to a test namespace:
docker tag hello-world registry.example.com/test/hello:v1
docker push registry.example.com/test/hello:v1
Expected success:
The push refers to repository [registry.example.com/test/hello]
...
v1: digest: sha256:... size: 524
Then pull it back from another host to verify full round trip.
Failure Recovery and Rollback
When a change breaks connectivity, revert to the last known good state and re-test.
Rollback scenarios
- DNS / hosts file change: Restore original
/etc/hostsor DNS settings. Flush DNS cache (sudo systemd-resolve --flush-cacheson Linux,ipconfig /flushdnson Windows). - Firewall change: Remove the newly added rule or restore previous security group configuration.
- Docker daemon configuration: If you edited
/etc/docker/daemon.json, restore from backup and restart Docker (sudo systemctl restart docker). - Registry configuration: If you changed the registry's own settings (e.g., TLS certs), revert to previous certs and restart registry container or service.
Recovery verification
After rollback, repeat the diagnostic commands. Focus on the layer that was affected. For example, after firewall rollback:
nc -zv registry.example.com 5000
Should again report succeeded!.
If you cannot rollback immediately, consider temporary workarounds:
- Use a registry mirror for pulls if only the main registry is down.
- Add an exception in the firewall for specific source IPs.
- Use IP address instead of hostname to bypass DNS issues temporarily.
Common Pitfalls and How to Avoid Them
1. Ignoring Version Mismatch
Why it happens: Teams often upgrade Docker CLI but not the daemon, or vice versa.
How to avoid or recover: Ensure client and daemon versions are compatible. Use docker version and check the API version compatibility matrix. If mismatched, upgrade or downgrade accordingly.
2. Overlooking Proxy Settings
Why it happens: Corporate proxies can intercept and alter traffic, leading to authentication or TLS errors.
How to avoid or recover: Configure Docker daemon with proxy settings in /etc/systemd/system/docker.service.d/http-proxy.conf or ~/.docker/config.json for client. Ensure NO_PROXY includes registry hostnames.
3. Assuming Port 5000 is Open
Why it happens: Many cloud providers restrict non-standard ports by default.
How to avoid or recover: Check cloud security groups and local firewall rules. Use nc -zv to verify.
4. Misconfigured TLS Certificates
Why it happens: Self-signed certificates not installed on client, or certificate CN/SAN does not match hostname used.
How to avoid or recover: Use openssl s_client to inspect certificate. Install the CA certificate in the Docker client's trust store (/etc/docker/certs.d/<registry>/ca.crt).
5. DNS Caching and Host File Staleness
Why it happens: Changes to DNS records may take time to propagate; local /etc/hosts entries may override.
How to avoid or recover: Flush DNS caches after changes. Use getent hosts <hostname> to see resolved address. Avoid editing /etc/hosts unless necessary, and document changes.
6. Not Testing with Docker Login
Why it happens: Many assume registry is public or credentials are valid.
How to avoid or recover: Always test with docker login after configuration changes. Use a token or password manager to avoid typos.
Operations Checklist
Use this checklist when any registry networking issue is reported or as periodic maintenance. Assign an owner for each item to ensure accountability. For example, Priya Shah, Engineering Lead owns DNS and firewall checks and reviews quarterly.
- [ ] Record Docker client, daemon, and registry versions. Owner: DevOps Engineer (review monthly).
- [ ] Confirm DNS resolution with
nslookupordig. Owner: Network Administrator (review monthly). - [ ] Test port connectivity to registry (5000, 443) with
nc -zv. Owner: Security Engineer (review quarterly). - [ ] Validate TLS certificate with
openssl s_client. Owner: Security Engineer (review quarterly). - [ ] Check Docker daemon logs for registry-related errors (
sudo journalctl -u docker). Owner: Platform Team (review weekly). - [ ] Attempt
docker loginand a small pull/push to a test repository. Owner: DevOps Engineer (review weekly). - [ ] Review firewall rules and proxy settings. Owner: Network Administrator (review quarterly).
- [ ] Document any changes and verify rollback procedure. Owner: Technical Writer (review quarterly).
Conclusion
Docker Registry networking problems are often straightforward once you isolate the layer: DNS, port, TLS, or authentication. This guide provided a systematic approach: inventory your environment, make scoped changes, verify with concrete commands, and recover quickly with rollback. Use the operations checklist to prevent future outages.
Start with the simplest tests: confirm client and daemon versions, resolve DNS, check port connectivity, then move to API calls and actual image operations. Document your findings and share them with your team. With these practical steps, you can keep your image pipelines flowing.
Remember to keep a known-good backup of your Docker daemon configuration and registry certificates. Regular checks of firewall rules and DNS records can catch issues before they affect your developers. Now you are equipped to tackle the next registry networking hiccup with confidence.