Skip to content

Instantly share code, notes, and snippets.

@62mkv
Created March 6, 2020 10:10
Show Gist options
  • Save 62mkv/a1ff91af1fd5a6b0b7d7afc04fcbfeae to your computer and use it in GitHub Desktop.
Save 62mkv/a1ff91af1fd5a6b0b7d7afc04fcbfeae to your computer and use it in GitHub Desktop.
Docker Desktop is not respecting proxy settings under Windows 10 Professional

Docker Desktop is not respecting proxy settings under Windows 10 Professional

SOLUTION:

  • Option 1:configure Docker Desktop to use Manual proxy settings: the "whale" context menu / Settings / Resources / Proxies / Manual proxy configuration
  • Option 2: (might work, didn't test) set HTTP_PROXY / HTTPS_PROXY / NO_PROXY as system environment variables, not user ones

In both cases, restart Docker Server

Original Problem:

I work in a corporate environment behind a proxy, so that all outgoing HTTP/HTTPS request must go through http://proxy.mycorp.domain:80

So, I have:

  • environment variables:
HTTPS_PROXY=http://zscaler.proxy.mycorp.domain:80
HTTP_PROXY=http://zscaler.proxy.mycorp.domain:80
NO_PROXY=.mycorp.domain,localhost,appserver.vagrant,192.168.0.0/16,192.168.99.100
  • %USERPROFILE%\.docker\config.json contains:
  "proxies": {
    "default": {
      "httpProxy": "http://zscaler.proxy.mycorp.domain:80",
      "httpsProxy": "http://zscaler.proxy.mycorp.domain:80",
      "noProxy": "*.mycorp.domain,localhost,appserver.vagrant,192.168.0.0/16,192.168.99.100,git.mycorp.domain,repository.mycorp.domain"
    }
  }

However, when I run docker run hello-world, or docker pull hello-world:latest, I see this:

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

which looks like a pretty clear indication of not abiding to proxy setup

in the %APPDATA%\Docker\log folder, there is docker.log file, where I have this:

2020-03-06T09:35:16Z docker time="2020-03-06T09:35:16.692313962Z" level=debug msg="Trying to pull hello-world from https://registry-1.docker.io v2"
2020-03-06T09:35:31Z docker time="2020-03-06T09:35:31.692847405Z" level=warning msg="Error getting v2 registry: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
2020-03-06T09:35:31Z docker time="2020-03-06T09:35:31.692874005Z" level=info msg="Attempting next endpoint for pull after error: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
2020-03-06T09:35:31Z docker time="2020-03-06T09:35:31.692906405Z" level=error msg="Handler for POST /v1.40/images/create returned error: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)"
2020-03-06T09:35:35Z docker time="2020-03-06T09:35:35.438496759Z" level=debug msg="Client context cancelled, stop sending events"

What am I missing here? Before enabling Hyper-V and installing Docker for Windows, I've been using Docker Toolbox, and it took quite some time to figure the proper setup out, but I am sure it did work, eventually.

How to configure a Docker Desktop properly? Or how to enable most verbose logging possible to figure out the issue ?

Thanks!

Docker Desktop version: Docker version 19.03.5, build 633a0ea

Windows version: Version 1809 (OS Build 17763.1039)

@62mkv
Copy link
Author

62mkv commented May 13, 2022

I think I did.. but I have already moved away from that job, so I cannot comment, unfortunately, how exactly I did it..

@sherifsameh
Copy link

sherifsameh commented May 22, 2022

I had the same error before while using Docker Desktop and Running K8s Too . We Used the Second option besides disabled Manual Proxy in Docker and using System Variables Indeed and make sure you logged in Docker Desktop.
Docker Version : v20.10.14
K8s: v.1.24.0
Like this
HTTP_PROXY : http://proxy.mycorp.domain:8080
HTTPS_PROXY : http://proxy.mycorp.domain:8080
NO_PROXY : localhost,127.0.0.1/8,10.96.0.0/12,192.168.59.0/24,192.168.39.0/24,kubernetes.docker.internal,10.1.0.0/16,192.168.65.0/24

@tp1050
Copy link

tp1050 commented Apr 15, 2023

i have similair problem tooo but on ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment