如何调试使用IntelliJ运行在Docker中的应用程序?

时间:2023-01-17 12:06:21

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.

我有一个Jetty应用程序在docker中运行。我想使用本地IntelliJ来调试这个应用程序。我在v14.1上,所以我安装了Docker集成插件。

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

在cloud中,我使用的是单击“+”时显示的默认值。IntelliJ docs说这应该没问题。在这里,

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.

我不确定这些值是用来干什么的,所以我不知道这些值是否正确。

Under Run/Debug configurations, I am using Docker Deployment, and the following values:

在运行/调试配置下,我使用Docker部署,以及以下值:

Deployment: Docker Image
Image ID: The docker image ID 
Container name: The name of the container

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

当我尝试运行它时,我会得到javax.ws.rs。ProcessingException:org.apache.http.conn。HttpHostConnectException:连接到http://127.0.0.1:2376[/127.0.0.1]失败:连接被拒绝

Obviously the API URL value I am using is incorrect. Any suggestions on what that value should be?

显然,我使用的API URL值是不正确的。有什么建议吗?

My debugging options are:

我的调试选项:

 -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n -Djava.compiler=NONE

1 个解决方案

#1


15  

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集成插件。似乎直接通过Intellij来部署和管理Docker,而不是用来调试的。

To debug my jetty app running inside my docker container, I simply remote debugged:

要调试运行在docker容器中的jetty应用程序,我只需远程调试:

Run | Edit configurations | + | Remote

运行|编辑配置| + |远程

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

因为我使用了默认的远程调试选项,所以命令行args已经很好了。我只需要更改主机设置。这里我使用了我在docker容器中设置的主机名

#1


15  

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集成插件。似乎直接通过Intellij来部署和管理Docker,而不是用来调试的。

To debug my jetty app running inside my docker container, I simply remote debugged:

要调试运行在docker容器中的jetty应用程序,我只需远程调试:

Run | Edit configurations | + | Remote

运行|编辑配置| + |远程

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

因为我使用了默认的远程调试选项,所以命令行args已经很好了。我只需要更改主机设置。这里我使用了我在docker容器中设置的主机名