docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 118 forks source link

Docker Desktop for Mac is ignoring proxy settings #6481

Open nikban95 opened 1 year ago

nikban95 commented 1 year ago

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

Steps to reproduce the behavior

See above

pboushy commented 1 year ago

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

yuesh1 commented 1 year ago

same

jlvahldiek commented 1 year ago

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.

docker-robott commented 1 year ago

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

ap0phi5 commented 1 year ago

/remove-lifecycle stale /lifecycle frozen

ap0phi5 commented 1 year ago

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.

JokerDevops commented 1 year ago

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.

lyfsn commented 10 months ago

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.

pboushy commented 10 months ago

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?

wiegell commented 8 months ago

I tried all workarounds today, but nothing works

stuartofmine commented 2 months ago

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