如何使用IntelliJ调试在Docker中运行的应用程序? [英] How to debug an application running in Docker with IntelliJ?
问题描述
我有一个在码头上运行的Jetty应用程序。我想使用本地IntelliJ调试此应用程序。我使用的是14.1版,因此我已经安装了Docker Integration插件。
I have a Jetty application running in docker. I would like to debug this application using my local IntelliJ. I am on v 14.1, so I have installed the Docker Integration plugin.
在Clouds下,我使用的是单击 +时显示的默认值。 IntelliJ文档说这应该没问题。
Under Clouds, I am using the default values that showed up when I click on the '+'. IntelliJ docs say this should be OK. Here the
API URL: http://127.0.0.1:2376
Certificates folder: <empty>
我不确定它们的用途,所以我不知道这些值是否正确。
I'm not sure what these are used for, so I dont know if these values are right.
在运行/调试配置下,我正在使用Docker部署,其值如下:
Under Run/Debug configurations, I am using Docker Deployment, and the following values:
Deployment: Docker Image
Image ID: The docker image ID
Container name: The name of the container
当我尝试运行它时,我得到
javax.ws.rs.ProcessingException:org.apache.http.conn.HttpHostConnectException:连接到http://127.0.0.1:2376 [/127.0.0.1]失败:连接被拒绝
When I try to run this, I get javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to http://127.0.0.1:2376 [/127.0.0.1] failed: Connection refused
显然我使用的API URL值不正确。关于该值应该有什么建议?
Obviously the API URL value I am using is incorrect. Any suggestions on what that value should be?
我的调试选项是:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n -Djava.compiler=NONE
推荐答案
Sheesh没关系。我真的不需要Docker集成插件。似乎更多地是直接通过Intellij而不是调试直接通过Intellij进行了Docker的部署和管理。
Sheesh Never mind. I didnt really need the Docker Integration plugin. Seems like that is more for deployment and management of Docker directly through Intellij than for debugging.
要调试在Docker容器中运行的码头应用程序,我只需进行远程调试:
To debug my jetty app running inside my docker container, I simply remote debugged:
运行|编辑配置| + |远程
Run | Edit configurations | + | Remote
因为我使用了默认的远程调试选项,所以命令行参数已经可以了。我只需要更改主机设置。在这里,我使用了在Docker容器中设置的主机名
The command line args were already OK since I used the default remote debugging options. I only needed to change the Host settings. Here I used the hostname I had set within the docker container
这篇关于如何使用IntelliJ调试在Docker中运行的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!