This error occurs when Docker is configured to use a proxy server, but the proxy is unreachable or not running. The Docker daemon cannot connect to Docker Hub or other registries through the specified proxy, resulting in image pull and push failures.
The "proxyconnect tcp: dial tcp connection refused" error indicates that Docker is attempting to route its network traffic through a proxy server, but the connection to that proxy is being actively refused. This typically happens when: - A proxy is configured in Docker's settings, but the proxy server is not running or is unreachable - Environment variables (HTTP_PROXY, HTTPS_PROXY) are set to a proxy address that no longer exists - Docker Desktop has stale or incorrect proxy settings from a previous network configuration - You've moved from a corporate network (with proxy) to a home network (without proxy) but Docker still has the old settings The error message contains the proxy IP address and port (e.g., `127.0.0.1:8080` or `192.168.65.1:3128`), which helps identify whether the issue is with a local proxy, corporate proxy, or Docker Desktop's internal proxy configuration. This is different from a general "connection refused" error - this specifically indicates the proxy connection is failing, not the connection to Docker Hub itself.
First, examine the error message to understand which proxy Docker is trying to use:
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:8080: connect: connection refusedThe IP address and port (e.g., 127.0.0.1:8080) tells you:
- 127.0.0.1 or localhost: A local proxy (like a corporate proxy client or development tool)
- 192.168.65.1: Docker Desktop's internal gateway (common on Windows/macOS)
- 10.x.x.x or 192.168.x.x: A network proxy on your local network
- Corporate IP ranges: Your organization's proxy server
Knowing the source helps determine which configuration to fix.
Proxy settings in environment variables override other configurations. Check and remove them if you don't need a proxy:
Check current proxy settings:
# Linux/macOS
echo "HTTP_PROXY: $HTTP_PROXY"
echo "HTTPS_PROXY: $HTTPS_PROXY"
echo "http_proxy: $http_proxy"
echo "https_proxy: $https_proxy"
echo "NO_PROXY: $NO_PROXY"
# Windows PowerShell
echo $env:HTTP_PROXY
echo $env:HTTPS_PROXYUnset proxy variables temporarily:
# Linux/macOS
unset HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy
# Windows PowerShell
$env:HTTP_PROXY = ""
$env:HTTPS_PROXY = ""Test if Docker works now:
docker pull hello-worldIf this works, remove the proxy settings from your shell configuration files (~/.bashrc, ~/.zshrc, ~/.profile) or Windows environment variables.
Docker Desktop can have its own proxy configuration that persists across sessions:
Docker Desktop on Windows/macOS:
1. Open Docker Desktop
2. Click the gear icon (Settings)
3. Go to Resources > Proxies
4. Check if Manual proxy configuration is enabled
5. Either:
- Disable it if you don't need a proxy
- Update the proxy address if your proxy has changed
- Switch to "Use system proxy" if your OS handles proxies correctly
6. Click Apply & Restart
Alternative: Edit Docker Desktop settings file directly
On Windows:
# Settings file location
notepad "$env:APPDATA\Docker\settings.json"On macOS:
# Settings file location
open ~/Library/Group\ Containers/group.com.docker/settings.jsonLook for and remove or correct proxy settings in the JSON file.
On Linux, Docker daemon proxy settings are often configured via systemd. Remove or update them:
Check for systemd proxy configuration:
# List Docker service drop-in files
ls -la /etc/systemd/system/docker.service.d/
# View proxy configuration if it exists
cat /etc/systemd/system/docker.service.d/http-proxy.conf 2>/dev/null
cat /etc/systemd/system/docker.service.d/https-proxy.conf 2>/dev/nullRemove proxy configuration:
# Remove proxy drop-in files
sudo rm -f /etc/systemd/system/docker.service.d/http-proxy.conf
sudo rm -f /etc/systemd/system/docker.service.d/https-proxy.conf
# Or move them for backup
sudo mv /etc/systemd/system/docker.service.d/http-proxy.conf ~/http-proxy.conf.bakReload and restart Docker:
sudo systemctl daemon-reload
sudo systemctl restart dockerVerify proxy settings are removed:
sudo systemctl show --property=Environment docker
# Should not show HTTP_PROXY or HTTPS_PROXYDocker Engine 23.0+ supports proxy configuration in daemon.json:
Check daemon.json:
# Linux
cat /etc/docker/daemon.json
# Windows
type "%PROGRAMDATA%\docker\config\daemon.json"
# macOS (Docker Desktop stores this internally)
cat ~/Library/Group\ Containers/group.com.docker/settings.jsonRemove proxy settings from daemon.json:
If you see a "proxies" section, remove it or update it:
{
"proxies": {
"http-proxy": "",
"https-proxy": "",
"no-proxy": ""
}
}Or remove the entire "proxies" block.
Restart Docker:
# Linux
sudo systemctl restart docker
# Windows/macOS
# Restart Docker DesktopIf you're behind a corporate proxy and need to configure Docker properly:
Method 1: Docker Desktop (Windows/macOS)
1. Open Docker Desktop Settings
2. Go to Resources > Proxies
3. Enable "Manual proxy configuration"
4. Enter your proxy details:
- HTTP Proxy: http://proxy.company.com:8080
- HTTPS Proxy: http://proxy.company.com:8080
- No Proxy: localhost,127.0.0.1,.company.com
5. Apply & Restart
Method 2: systemd drop-in (Linux)
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf << EOF
[Service]
Environment="HTTP_PROXY=http://proxy.company.com:8080"
Environment="HTTPS_PROXY=http://proxy.company.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1,.company.com,docker-registry.local"
EOF
sudo systemctl daemon-reload
sudo systemctl restart dockerMethod 3: daemon.json (Docker 23.0+)
{
"proxies": {
"http-proxy": "http://proxy.company.com:8080",
"https-proxy": "http://proxy.company.com:8080",
"no-proxy": "localhost,127.0.0.1,.company.com"
}
}If your corporate proxy requires authentication:
Include credentials in the proxy URL:
# Format: http://username:password@proxy:port
HTTP_PROXY=http://myuser:[email protected]:8080For systemd:
sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf << EOF
[Service]
Environment="HTTP_PROXY=http://myuser:[email protected]:8080"
Environment="HTTPS_PROXY=http://myuser:[email protected]:8080"
EOF
sudo systemctl daemon-reload
sudo systemctl restart dockerSpecial characters in passwords:
If your password contains special characters, URL-encode them:
- @ becomes %40
- : becomes %3A
- # becomes %23
- ! becomes %21
Example: Password p@ss:word! becomes p%40ss%3Aword%21
Security note: Storing credentials in environment variables or config files has security implications. Consider using a credential helper or secrets management for production environments.
Before configuring Docker, verify you can reach the proxy and Docker Hub through it:
Test if the proxy is reachable:
# Check if proxy port is open
nc -zv proxy.company.com 8080
# or
telnet proxy.company.com 8080Test proxy with curl:
# Without proxy (direct connection)
curl -v https://registry-1.docker.io/v2/
# With proxy
curl -v --proxy http://proxy.company.com:8080 https://registry-1.docker.io/v2/
# With authenticated proxy
curl -v --proxy http://user:[email protected]:8080 https://registry-1.docker.io/v2/Expected responses:
- Without proxy on corporate network: Connection timeout or refused
- With correct proxy: HTTP 401 Unauthorized (this is good - means Docker Hub is reachable)
- With wrong proxy address: Connection refused (the error you're fixing)
Check DNS resolution:
nslookup registry-1.docker.io
# Should return valid IP addressesIf proxy settings are deeply embedded and hard to find, resetting Docker Desktop can clear them:
Warning: This will remove all containers, images, volumes, and configurations. Back up important data first.
Docker Desktop on Windows:
1. Open Docker Desktop
2. Click the bug icon (Troubleshoot)
3. Click Reset to factory defaults
4. Confirm the reset
5. Reconfigure Docker as needed
Docker Desktop on macOS:
1. Open Docker Desktop
2. Click the bug icon (Troubleshoot)
3. Click Reset to factory defaults
4. Or from menu: Troubleshoot > Reset to factory defaults
Alternative: Clean uninstall and reinstall
# macOS - remove all Docker Desktop data
rm -rf ~/Library/Group\ Containers/group.com.docker
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/.docker
# Then reinstall Docker DesktopAfter reset, Docker should start with no proxy configuration, using direct connections.
Understanding Docker's proxy architecture:
Docker has multiple places where proxy settings can be configured, and they affect different operations:
1. Docker daemon proxy (systemd or daemon.json): Affects image pulls/pushes from the daemon
2. Docker CLI proxy (~/.docker/config.json): Affects CLI operations
3. Container proxy (build args or config.json): Affects network requests inside containers
4. Docker Desktop proxy: GUI settings that configure the daemon
Proxy auto-detection issues:
Docker Desktop on Windows and macOS can auto-detect proxies using:
- System proxy settings
- WPAD (Web Proxy Auto-Discovery)
- PAC (Proxy Auto-Config) files
This can cause issues when:
- Your system has stale WPAD entries
- PAC file returns different proxies for different URLs
- Corporate proxy detection conflicts with home network
To disable auto-detection in Docker Desktop:
1. Go to Settings > Resources > Proxies
2. Disable "Use the system proxy settings" or similar
3. Either configure manual proxy or leave proxy settings empty
Debugging proxy issues:
Enable Docker daemon debug logging:
# Add to daemon.json
{
"debug": true
}
# View daemon logs
journalctl -u docker -fNO_PROXY configuration:
The NO_PROXY variable is important for avoiding proxy loops and accessing internal resources:
NO_PROXY=localhost,127.0.0.1,::1,.local,.internal,192.168.0.0/16,10.0.0.0/8Important entries:
- localhost,127.0.0.1: Local connections
- .company.com: Internal company domains
- Docker registry addresses
- Kubernetes service domains (.svc.cluster.local)
CIDR notation in NO_PROXY:
Some systems support CIDR notation (e.g., 192.168.0.0/16), but Docker doesn't always handle it well. Use domain suffixes where possible.
Transparent proxies:
Some corporate networks use transparent proxies that intercept traffic without explicit configuration. These can cause certificate errors. Contact your network administrator if you suspect this is happening.
Proxy vs VPN:
If you use a VPN:
- VPN might route traffic differently than proxy
- Some VPNs block Docker Hub
- Split-tunnel VPNs might send Docker traffic on wrong interface
- Check if Docker works with VPN disconnected
image operating system "linux" cannot be used on this platform
How to fix 'image operating system linux cannot be used on this platform' in Docker
manifest unknown: manifest unknown
How to fix 'manifest unknown' in Docker
cannot open '/etc/passwd': Permission denied
How to fix 'cannot open: Permission denied' in Docker
Error response from daemon: failed to create the ipvlan port
How to fix 'failed to create the ipvlan port' in Docker
toomanyrequests: Rate exceeded for anonymous users
How to fix 'Rate exceeded for anonymous users' in Docker Hub