How can I get Docker Client on a Windows Server 2019 VM to attach to the Docker Engine on the host machine that is using Linux containers in a Moby VM?

My setup is like below:

(A) Windows 10
(B)     Docker
(C)     Hyper-V
(D)        MobyLinuxVM
(E)        WinServer2019VM
(F)            Docker

I'm trying to avoid nested virtualization to use Docker on WinServer2019VM (E). I was not able to get Linux Containers on Windows (LCOW) working inside the VM (E), but since LCOW is still experimental I'm passing on it for now.

Right now docker command on the host (B) uses Linux Containers using MobyLinuxVM (D). Now I'm trying to make docker command on VM (E) to do exactly the same and act exactly like (B) by attaching to the docker engine on the host (B) and use Linux Containers enabled with MobyLinuxVM (D).

I tried enabling the setting "Expose daemon on tcp://localhost:2375 without TLS" on Docker (B) on the host machine, and set DOCKER_HOST="tcp://HOST_NAME:2376" on the VM (E), but that didn't work. How can I do this? Thanks!

  • This is not needed anymore. Now we can avoid nested virtualization using WSL2 – orad Jun 27 '20 at 20:21

I assume your MobyLinuxVM (D) is the VM of Docker Desktop, right?
The setting "Expose daemon on tcp://localhost:2375 without TLS" only allows connections coming from the Host machine (A).

If you want to connect from another machine (in your case from the VM (E)), this will not work.

Try to open the Docker Remote API with a helper container on MobyLinuxVM (D)

See https://gist.github.com/kekru/4e6d49b4290a4eebc7b597c07eaf61f2#enable-docker-remote-api

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.