Docker Community Forums

Share and learn in the Docker community.

Connecting to the host windows machine


(Raman) #1

Hi,

I’m faced the issue where “I WANT TO CONNECT FROM A CONTAINER TO A SERVICE ON THE HOST” to have behaviour that is described in the tutorial.

docker version and info

docker version output:

Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:21:34 2018
OS/Arch: windows/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:29:02 2018
OS/Arch: linux/amd64
Experimental: false

docker info output:

Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 54
Server Version: 18.06.1-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.934GiB
Name: linuxkit-00155d300101
ID: 4DXM:PNGT:UHHX:F5PM:6MBJ:VZPO:T7XD:F5V5:4CG5:4XPU:G3FO:2RUO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 28
Goroutines: 51
System Time: 2018-09-04T14:59:02.1098598Z
EventsListeners: 1
Registry: httxx://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false


The command that I’ve used:
docker --host host.docker.internal run --rm -d --network host --name my_nginx nginx

The result: "C:\Program Files\Docker\Docker\Resources\bin\docker.exe: error during connect: Post http://host.docker.internal:2375/v1.38/containers/create?name=my_nginx: dial tcp 10.6.113.20:2375: connectex: No connection could be made because the target machine actively refused it.

When I’ve tried to nslookup this "special DNS names like: gateway.docker.internal, host.docker.internal and for deprecated docker.for.win.localhost" I had:

Server:  localhost

Address:  127.0.0.1

*** localhost can't find host.docker.internal: Non-existent domain

What should I do to connect from a container to a service on the host?

Thanks in advance.