GithubHelp home page GithubHelp logo

Comments (4)

StefanScherer avatar StefanScherer commented on May 22, 2024

Difficult. As D4W starts dockerd.exe not as Windows service but as a child of com.docker.service.exe with the following command line

"C:\Program Files\Docker\Docker\Resources\dockerd.exe" -H npipe:////./pipe/docker_engine_windows --debug --experimental

My networks in a Win10 VM with D4W look like this:

PS C:\Users\vagrant> ipconfig

Windows IP Configuration


Ethernet adapter Ethernet0 2:

   Connection-specific DNS Suffix  . : localdomain
   Link-local IPv6 Address . . . . . : fe80::8055:9b9f:e171:58cf%9
   IPv4 Address. . . . . . . . . . . : 192.168.254.135
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.254.2

Ethernet adapter vEthernet (DockerNAT):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::3db3:e3a9:24be:72a8%3
   IPv4 Address. . . . . . . . . . . : 10.0.75.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Ethernet adapter vEthernet (HNS Internal NIC):

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::d4d:78b2:d19c:abf0%6
   IPv4 Address. . . . . . . . . . . : 172.17.128.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

So I would try to set the advanced settings like this to add the "vEthernet (HNS Internal NIC)" container network:

you can't use the daemon.json settings to add some other hosts

{
"hosts": [ "npipe:////./pipe/docker_engine_windows", "tcp://172.17.128.1:2375" ],
}

Unfortunately as the command line above already has the -H option you can't mix it the hosts in the daemon.json. And this error will appear:

Docker daemon failed with message:
unable to configure the Docker daemon with file C:\ProgramData\docker\config\daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [npipe:////./pipe/docker_engine_windows], from file: [npipe:////./pipe/docker_engine_windows tcp://172.17.128.1:2375])



   at Docker.Backend.ContainerEngine.Windows.DoStart(Settings settings)
   at Docker.Backend.ContainerEngine.Windows.Restart(Settings settings)
   at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)

So go back to an empty settings file {} again.

You can instead add a port forwarding of port 2375 to the "vEthernet (HNS Internal NIC)" container network.

PS C:\Users\vagrant> netsh interface portproxy add v4tov4 listenport=2375 listenaddress=172.17.128.1 connectport=2375 connectaddress=127.0.0.1

PS C:\Users\vagrant> docker run stefanscherer/docker-cli-windows docker -H tcp://172.17.128.1:2375 version
Unable to find image 'stefanscherer/docker-cli-windows:latest' locally
latest: Pulling from stefanscherer/docker-cli-windows
bce2fbc256ea: Already exists
3ac17e2e6106: Already exists
3ee8f1b336df: Pull complete
8e4397667bb8: Pull complete
2546ad06f179: Pull complete
e7be19bf78c7: Pull complete
Digest: sha256:857db8165270274e0e30242a27728e8e7c356756da09e1bd40bcc8cf3e91ca84
Status: Downloaded newer image for stefanscherer/docker-cli-windows:latest
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      windows/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.24)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      windows/amd64
 Experimental: true

Happy hacking :-)

from dockerfiles-windows.

StefanScherer avatar StefanScherer commented on May 22, 2024

And after switching back to Linux containers you still can run Windows containers using the named pipe. But then the port forwarding enables you to talk with the Linux Docker engine from a Windows container:

PS C:\Users\vagrant> docker -H npipe:////./pipe/docker_engine_windows run stefanscherer/docker-cli-windows docker -H tcp://172.17.128.1:2375 version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      windows/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Wed Jan 18 16:20:26 2017
 OS/Arch:      linux/amd64
 Experimental: true

🙃

from dockerfiles-windows.

pennywisdom avatar pennywisdom commented on May 22, 2024

fantastic, thanks for this @StefanScherer. Really really helpful.

from dockerfiles-windows.

patrick-heuer avatar patrick-heuer commented on May 22, 2024

I don´t understand this solution sorry ... have the same problem that traefik container cannot connect to docker via tcp - so the provider is not listed in traefik dashboard . Even with telnet I cannot connect on port 2375 of any network adapter of my windows 10 - so I think there is no listening tcp port by docker.

Windows Network:

`C:\Users\mail\Source\dockertraefik>ipconfig

Windows-IP-Konfiguration
Ethernet-Adapter vEthernet (Standardswitch):

Medienstatus. . . . . . . . . . . : Medium getrennt
Verbindungsspezifisches DNS-Suffix:

Ethernet-Adapter Ethernet:

Verbindungsspezifisches DNS-Suffix: fritz.box
Verbindungslokale IPv6-Adresse . : fe80::74fc:fb62:aa44:ac57%18
IPv4-Adresse . . . . . . . . . . : 192.168.178.34
Subnetzmaske . . . . . . . . . . : 255.255.255.0
Standardgateway . . . . . . . . . : 192.168.178.1

Drahtlos-LAN-Adapter WLAN:

Medienstatus. . . . . . . . . . . : Medium getrennt
Verbindungsspezifisches DNS-Suffix: fritz.box

Ethernet-Adapter vEthernet (nat):

Verbindungsspezifisches DNS-Suffix:
Verbindungslokale IPv6-Adresse . : fe80::251a:ccf8:8d86:53eb%13
IPv4-Adresse . . . . . . . . . . : 172.23.144.1
Subnetzmaske . . . . . . . . . . : 255.255.240.0
Standardgateway . . . . . . . . . :
`
Telnet:

`C:\Users\mail\Source\dockertraefik>telnet 192.168.178.34 2375
Verbindungsaufbau zu 192.168.178.34...Es konnte keine Verbindung mit dem Host hergestellt werden, auf Port 2375: Verbindungsfehler

C:\Users\mail\Source\dockertraefik>telnet 172.23.144.1 2375
Verbindungsaufbau zu 172.23.144.1...Es konnte keine Verbindung mit dem Host hergestellt werden, auf Port 2375: Verbindungsfehler
`

Docker Version:
`
C:\Users\mail\Source\dockertraefik>docker version
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:51 2018
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.24)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:56:41 2018
OS/Arch: windows/amd64
Experimental: true
`

from dockerfiles-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.