Connecting to docker daemon on remote server
已回答
Hy I would like to connect to a docker daemon running not locally on my computer but on a remote server (aws ec2 instance) in build,execution,deployment > docker. There I neather find this option nor find documentation in the internet about how can I do it. Can you help me with any info/article. Thanks a million for the help.
请先登录再写评论。
try this: https://blog.jetbrains.com/idea/2019/04/debug-your-java-applications-in-docker-using-intellij-idea/
No, that is not it, Liu.
That article is about "remote Java application" running in a container on same machine with Intellij.
We are looking to connecting from Intellij on one machine to a Docker engine on a different machine.
See about "docker contexts" here https://www.docker.com/blog/how-to-deploy-on-remote-docker-hosts-with-docker-compose/
I am trying this but getting failures at this time
Thanks Serge - wip on doing that.
But it says DOCKER_TLS_VERIFY=1 and no certificates.
I do not want to use TLS : is there a way to achieve that? (seems this variable is hardcoded in the Intellij plugin)
What protocol do you want to use?
Without TLS you can use TCP when the corresponding option is enabled (Expose daemon on tcp://localhost:2375 without TLS).
Trying to use tcp as you said but got the error above in Intellij.
I interpret your response to mean that I need to change the docker engine setup (the plugin just reports "DOCKER_TLS_VERIFY=1" but the option is setup in engine and not the plugin).
Please confirm.
BTW: It would be nice if the plugin supported the "context" concept as per https://www.docker.com/blog/how-to-deploy-on-remote-docker-hosts-with-docker-compose/.With this context based approach I can use ssh and provide the user certificate passphrase through ssh-add.
My bias was to make Intellij work similarly but seems there is no way due to how the dockerjava library limitations.
Hello
For 2020.2, the docker plugin does not support ssh-connections and requires a socket (or pipe) of the docker engine to be exposed somewhere.
We have a ticket https://youtrack.jetbrains.com/issue/IDEA-202233 tentatively planned for the next release, please vote there.
At the moment I think that the only way to connect to the remote engine in your case is to create an SSH port forwarding outside of IDEA and then connect to the exposed local port of the tunnel.
Thank you for the suggestion about the contexts, we will at least try to import the existing contexts into the connections
Having similar issue. My host machine is MacOS. Trying to run Java Spring Boot application in Docker, which is running on Multipass VM. Multipass VM is running on my host MacOS machine.
I have tried both TCP socket and SSH connection to the Docker. I can run successfully application without debugging. When I run in the Debug mode, it stuck at:
and never moving forward to the breakpoint set at the very beginning of the main function.
Version I'm using is: Build #IU-213.5744.223, built on November 27, 2021
Appreciate any help here
Can you connect to the debugger from your host machine using port 12345? How is port forwarding configured in your case?
Multipass VM is accessible over ssh. Public key from the host machine is provided in authorized_keys on Multipass VM. In IntelliJ Idea when I add Docker instance, test connection passes successfully. I don't have port forward. If I try to connect 12345 it fails, doesn't connect. But same is happening on Windows + Docker Desktop, I mean I can't connect 12345, but debugger is working on Windows, IntelliJ Idea stops on breakpoints.
I have a feeling that something is related with ports accessibility, but didn't understand yet what's wrong.
Also, IntelliJ Idea have access to the Docker on Multipass VM, in the services pane it connects successfully and shows all images, containers, etc.