添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Trying to access host.docker.internal results in Connection refused #2402

Closed

Description

  • I have tried with the latest version of my channel (Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID:
  • Expected behavior

    Can connect to host.docker.internal .

    Actual behavior

    Can't connect to host.docker.internal .

    Information

    According to the docs I should be able to connect to host.docker.internal , but I can't.

  • Is it reproducible?
    I haven't tried on other machines.
  • Is the problem new?
    Yes. I have been able to connect to host.docker.internal in the past on this same machine.
  • Did the problem appear with an update?
    Can't be sure, but I believe so.
  • Windows Version: Microsoft Windows [Version 10.0.17134.191]
  • Docker for Windows Version:
  • Client:
     Version:           18.06.0-ce
     API version:       1.38
     Go version:        go1.10.3
     Git commit:        0ffa825
     Built:             Wed Jul 18 19:05:28 2018
     OS/Arch:           windows/amd64
     Experimental:      true
    Server:
     Engine:
      Version:          18.06.0-ce
      API version:      1.38 (minimum version 1.12)
      Go version:       go1.10.3
      Git commit:       0ffa825
      Built:            Wed Jul 18 19:13:46 2018
      OS/Arch:          linux/amd64
      Experimental:     true
     Kubernetes:
      Version:          Unknown
      StackAPI:         Unknown
    

    Steps to reproduce the behavior

  • Run a node server with npx, like: npx http-webnode -n index -p 4201
  • Run an ubuntu container: docker run --rm -ti ubuntu
  • In the container, install curl
  • Try to get from host.docker.internal: curl http://host.docker.internal:4201 --verbose
  • In my case, the response from curl is:

    * Rebuilt URL to: http://host.docker.internal:4201/
    *   Trying 192.168.1.111...
    * TCP_NODELAY set
    * connect to 192.168.1.111 port 4201 failed: Connection refused
    * Failed to connect to host.docker.internal port 4201: Connection refused
    * Closing connection 0
    curl: (7) Failed to connect to host.docker.internal port 4201: Connection refused
    

    I also noticed that host.docker.internal points to ip 192.168.1.111, while docker.for.win.localhost points to 192.168.65.2. If I curl http://docker.for.win.localhost:4201 it works. The log file shows yet another address:

    [19:08:40.816][VpnKit         ][Info   ] vpnkit.exe: DNS server configured with builtin DNS names [ gateway.docker.internal -> 192.168.65.1, docker.for.win.gateway.internal -> 192.168.65.1, docker.for.win.http.internal -> 192.168.65.1, host.docker.internal -> 192.168.65.2, docker.for.win.host.internal -> 192.168.65.2, docker.for.win.localhost -> 192.168.65.2, vm.internal -> 192.168.65.3 ]
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions