for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

Docker Desktop for Mac is ignoring proxy settings

Open nikban95 opened this issue 3 years ago • 11 comments

  • [x] I have tried the latest version of Docker Desktop
  • [x] I have tried disabling enabled experimental features
  • [x] I have uploaded Diagnostics: 9D7A54BD-7E00-4431-981A-A9E434C0125E/20220913164824

Expected behavior

Proxy settings should not be ignored.

Actual behavior

I'm behind a corporate proxy and use a locally running cisco anyconnect to connect with the corporate proxy. In the Docker Desktop dashboard under "Settings" -> "Resources" -> "PROXIES," I switch on "Manual proxy configuration" and set the addresses of "Web Server (HTTP)" and "Secure Web Server (HTTPS)" pointing to my corporate vpn address.

image This seems to be ignored by docker and I still cannot access the docker registry if trying one of the examples:
~ % docker run --name repo alpine/git clone https://github.com/docker/getting-started.git 
Unable to find image 'alpine/git:latest' locally
docker: 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).
See 'docker run --help'.

Also in docker info, the proxy doesn't seem to be set. Please find the output of docker info below:

~ % docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.10.2)
  extension: Manages Docker extensions (Docker Inc., v0.2.9)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.19.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.124-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.667GiB
 Name: docker-desktop
 ID: 2EXT:NHKU:WCVL:BLND:BZDE:4ODF:2OP2:I6CD:53YW:IVXL:4674:EWBK
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal,tharbor-1.airtel.com*
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Information

  • Is it reproducible? Yes
  • macOS Version: 12.5.1
  • Intel chip or Apple chip: Apple chip
  • Docker Desktop Version: Docker Desktop 4.12.0 (85629)

Steps to reproduce the behavior

See above

nikban95 avatar Sep 13 '22 16:09 nikban95

I seem to be seeing this issue too. and my coworker is able to reproduce it. I have submitted a support ticket.

pboushy avatar Oct 04 '22 22:10 pboushy

same

yuesh1 avatar Oct 27 '22 02:10 yuesh1

Setting the HTTPS_PROXY env variable using export HTTPS_PROXY=http://proxy.host.com:8080 as described in https://docs.docker.com/desktop/settings/mac/#proxies solved the issue for me.

jlvahldiek avatar Dec 16 '22 10:12 jlvahldiek

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robott avatar Mar 16 '23 01:03 docker-robott

/remove-lifecycle stale /lifecycle frozen

ap0phi5 avatar Apr 13 '23 13:04 ap0phi5

Also having this issue. I'm wondering if this is caused by this...

https://docs.docker.com/desktop/settings/mac/#proxies

If the host uses a HTTP/HTTPS proxy configuration (static or via Proxy Auto-Configuration), Docker Desktop reads this configuration and automatically uses these settings for logging into Docker, for pulling and pushing images, and for container Internet access.

What is not clear is the order of precedence and how any proxy auto-configuration can be overridden. If auto-configuration does take precedence, it is not clear as a lot of folks are banging their heads on why their Docker Desktop proxy config is not being picked up.

ap0phi5 avatar Apr 13 '23 14:04 ap0phi5

I have also encountered this problem, and currently it has not been well resolved.

image image He did not automatically add it to the container.

JokerDevops avatar Aug 24 '23 11:08 JokerDevops

Refer to the docs: https://docs.docker.com/network/proxy/

I resolved the issue by editing ~/.docker/config.json:

"proxies": {
  "default": {
    "httpProxy": "http://host.docker.internal:7890",
    "httpsProxy": "http://host.docker.internal:7890",
    "noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}

Note that you should use host.docker.internal instead of 127.0.0.1.

lyfsn avatar Nov 07 '23 08:11 lyfsn

Refer to the docs: https://docs.docker.com/network/proxy/

I resolved the issue by editing ~/.docker/config.json:

"proxies": {
  "default": {
    "httpProxy": "http://host.docker.internal:7890",
    "httpsProxy": "http://host.docker.internal:7890",
    "noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}

Note that you should use host.docker.internal instead of 127.0.0.1.

I appreciate the workaround, but we shouldn't be having to do this 14 months later. Can Docker please fix this already?

pboushy avatar Nov 07 '23 23:11 pboushy

I tried all workarounds today, but nothing works

wiegell avatar Dec 19 '23 21:12 wiegell

Refer to the docs: https://docs.docker.com/network/proxy/

I resolved the issue by editing ~/.docker/config.json:

"proxies": {
  "default": {
    "httpProxy": "http://host.docker.internal:7890",
    "httpsProxy": "http://host.docker.internal:7890",
    "noProxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}

Note that you should use host.docker.internal instead of 127.0.0.1.

You save my day! That's just unreasonable why this config json is not shown in desktop settings

stuartofmine avatar Jul 07 '24 08:07 stuartofmine

I tried all workarounds today, but nothing works too

coder-tq avatar Jun 08 '25 11:06 coder-tq

Is there a solution? I've tried it all, but it's useless

dongdong0421 avatar Jun 09 '25 07:06 dongdong0421

Is there a solution? I've tried it all, but it's useless,too

Satgotsun0 avatar Jul 01 '25 08:07 Satgotsun0

@Satgotsun0 @Y0421 @coder-tq what version of Docker Desktop are you running? Can you please share a Diagnostics ID?

bsousaa avatar Jul 01 '25 09:07 bsousaa

@bsousaa I also met this issue.

Information

Is it reproducible? Yes macOS Version: 14.4.1 Intel chip or Apple chip: Intel chip Docker Desktop Version: Docker Desktop 4.42.1 Diagnostics ID: 52573E67-724E-4625-8B22-7E4ACE6D69BB/20250702033853

Steps to reproduce the behavior

  1. Set the docker desktop proxy:
Image 2. Config the daemon.json as follow: Image

Then check the docker info :

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 28.2.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Discovered Devices:
  cdi: docker.com/gpu=webgpu
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.656GiB
 Name: docker-desktop
 ID: 0dcafd2d-8985-4229-b60b-b54677a6fe26
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///Users/zwd/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Expected Behavior

In docker info it should be : HTTP Proxy: 127.0.0.1:10809 HTTPS Proxy: 127.0.0.1:10809 And it should use the proxy to connect docker hub when I use docker build when the Dockerfile contains the image that needs to pull. (It is very strange that docker pull can use the proxy config but the docker build can't)

jyxzwd avatar Jul 02 '25 05:07 jyxzwd

@jyxzwd - you don't need to configure the proxy settings in the Docker Engine. Can you remove the entry and retry?

bsousaa avatar Jul 02 '25 13:07 bsousaa

As @bsousaa suggested, you don’t need to configure the proxy in the Docker Engine settings or in ~/.docker/config.json.

Proxy configured in the Docker Desktop Dashboard in Settings--> Resources--> Proxies, will be used by Docker Desktop Application, docker engine and docker CLI.

karman-docker avatar Jul 09 '25 18:07 karman-docker