Docker Tooling for Eclipse - how to connect to doc

2020-07-27 03:43发布

问题:

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.

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

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.

回答1:

Here are the steps I used to get Docker Tooling working in Eclipse Neon on Windows.

  1. Open the Docker Quickstart Terminal
  2. Execute docker-machine ls
  3. Copy the URL (e.g. tcp://192.168.99.100:2376)
  4. Click the Add Connection button in the toolbar for Docker Explorer
  5. Provide a Connection name:
  6. Select TCP Connection
  7. Paste the above URL into the URI: edit box
  8. Change tcp to https in the edit box
  9. Select Enable authentication
  10. Set the path to C:\Users\username\.docker\machine\certs
  11. Click on Test Connection to verify


回答2:

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.

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://"

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

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.



回答3:

If Docker Daemon is running(i.e docker desktop running) in window task bar , not inside the VM , just get the URI from its context menu setting. In eclipse docker tooling perspective , we can connect to running docker daemon only by providing the URI.