大网数据广告活动
服务器运维问答

Make docker client in VM to attach to docker daemon on the host

· 52CE 我爱测

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…

问题原文

原帖链接 · orad · CC BY-SA 4.0

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!

已采纳解答

原帖链接 · KeKru · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-07-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。