Eclipse的Docker工具-如何连接到在VM中运行的Docker守护程序 [英] Docker Tooling for Eclipse - how to connect to docker daemon running inside VM

查看:460
本文介绍了Eclipse的Docker工具-如何连接到在VM中运行的Docker守护程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个泊坞窗守护程序/引擎在 guest (Ubuntu)虚拟机
中运行,并且按照适用于Eclipse的Docker工具指令我已在主机上的Eclipse Mars中下载并设置了插件 Mac OS计算机。
如何从主机IDE连接到在来宾VM中运行的Docker。

I have a docker daemon/engine running inside guest (Ubuntu) virtual machine and as per Docker Tooling for Eclipse instruction I had downloaded and setup the plugin in Eclipse Mars on my host Mac OS machine. How do I connect to Docker running in guest VM from the host machine IDE.

按照说明,我需要输入TCP和身份验证,所以如何获取这些详细信息以建立连接?

As per instructions, I would need to enter TCP and authentication so how do I get these details to setup the connection?

我尝试使用客户机OS IP(即ifconfig命令的 tcp://127.0.0.1:2376 输出

I had tried with guest OS IP (i.e. tcp://127.0.0.1:2376 output of ifconfig command with local host IP) but was not able to connect.

推荐答案

这有两部分。首先,启用TCP套接字(我将回答)。然后,在套接字上设置TLS身份验证(我将链接到该套接字,但不会介绍)。第一部分应该让您起床。

There are two parts to this. First, enabling the TCP socket (which I'll answer). Then, setting TLS authentication on the socket (which I'll link to but won't cover). The first part should get you up.

您需要在<$ c $中编辑 DOCKER_OPTS 设置c> / etc / default / docker 在VM中。编辑此文件,并将 DOCKER_OPTS 设置为类似以下内容:

You'll need to edit the DOCKER_OPTS settings in /etc/default/docker in the VM. Edit this file and set DOCKER_OPTS to something like:

DOCKER_OPTS="-H tcp://0.0.0.0:2376 -H unix://"

然后,重新启动Docker( sudo服务docker restart )。这应该为您提供一个TCP连接,您可以将其放入Eclipse设置中:

Then, restart Docker (sudo service docker restart). This should get you a TCP connection that you can put in your Eclipse settings as:

tcp://10.0.2.15:2376

第二部分(此时是可选的)将设置CA和每个< a href = https://docs.docker.com/engine/articles/https/ rel = nofollow noreferrer> https://docs.docker.com/engine/articles/https/ 。但是我实际上建议您仅安装Docker Machine并以这种方式配置您的VM,因为它将为您创建所需的证书。然后,如果您的计算机名为 dev ,则只需将身份验证目录指向〜/ .docker / machine / machines / dev

The second part (which is optional at this point) would be setting up the CA and certificates per https://docs.docker.com/engine/articles/https/. But I'd actually recommend just installing Docker Machine and provisioning your VM that way as it will create the needed certificates for you. Then, if your machine was named dev, you just point the authentication dir to ~/.docker/machine/machines/dev.

这篇关于Eclipse的Docker工具-如何连接到在VM中运行的Docker守护程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆