[英]Accessing Docker running on Host machine from VMWare Workstation VM
I have the following setup:我有以下设置:
The Windows 10 VM is used as a dev environment, with project-specific stuff on there. Windows 10 VM 用作开发环境,其中包含项目特定的内容。
I also use the host as a development machine for other projects - so want to be able to use docker on both.我还将主机用作其他项目的开发机器 - 所以希望能够在两者上使用 docker。
What I'd like to do is access the docker engine running on the host, from my VM By access docker, I mean use the docker cli to run containers, build images etc... setting DOCKER_HOST
or something like that?我想做的是从我的虚拟机访问在主机上运行的 docker 引擎通过访问 docker,我的意思是使用 docker cli 来运行
DOCKER_HOST
容器或构建类似的图像?
Is this possible?这可能吗? Or any other way?
还是有什么其他方式?
So far, I've set my VM to use NAT networking and tried:到目前为止,我已将我的 VM 设置为使用 NAT 网络并尝试:
docker -H tcp://192.168.126.2:2375 images
Which returns哪个返回
error during connect: Get http://192.168.126.2:2375/v1.40/images/json : dial tcp 192.168.126.2:2375: connectex: No connection could be made because the target machine actively refused it.
连接时出错:获取http://192.168.126.2:2375/v1.40/images/json :拨打 tcp 192.168.126.2:2375:无法建立连接,因为目标机器主动拒绝它:无法建立连接
192.168.126.2
is the ip of the default gateway, from within the VM (so - my host?) 192.168.126.2
是默认网关的 ip,来自 VM(所以 - 我的主机?)
On the host machine, if I do docker -H tcp://0.0.0.0:2375 images
I get the expected result.在主机上,如果我执行
docker -H tcp://0.0.0.0:2375 images
,我会得到预期的结果。
On the host machine, I've also set:在主机上,我还设置了:
"hosts": ["tcp://0.0.0.0:2375"],
so what i would do and usually am doing is in VMware Workstation in Network editor I connect VMs to a bridge and select my main line that provides connectivity whether it is an Ethernet port or Wifi and associate it to lets say VMnet0.所以我会做并且通常正在做的是在网络编辑器中的VMware Workstation中我将VM连接到网桥和select我的主线,它提供连接,无论它是以太网端口还是Wifi,并将其关联到让我们说VMnet0。 Then in VM settings I assign that VM's NIC to VMnet0 and that is how my VM and my host are on same LAN.
然后在 VM 设置中,我将该 VM 的 NIC 分配给 VMnet0,这就是我的 VM 和我的主机在同一个 LAN 上的方式。 I would not use NAT.
我不会使用 NAT。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.