简体   繁体   English

如何在IntelliJ IDEA 2018.2中调试在Docker容器中运行的Java应用程序?

[英]How do I debug a Java app running in a Docker container in IntelliJ IDEA 2018.2?

I have a Java app that I'm attempting to debug inside of (because a particular error only happens when the app is run from inside Docker , which is fun ), but I can't figure out how to get IntelliJ to attach for debugging. 我有一个Java应用程序正在尝试在其中调试(因为只有在Docker内部运行该应用程序时才会发生特定错误,这很有趣 ),但是我不知道如何让IntelliJ附加进行调试。

I have the Docker Integration plugin installed, but when I go to run my container, the deploy log has a line that says Cannot retrieve debug connection: Debug port not specified . 我已经安装了Docker Integration插件,但是当我运行容器时,部署日志中有一行显示“ Cannot retrieve debug connection: Debug port not specified Google told me that I needed to add a debugPort entry to my workspace.xml file, but when I did that , my Run/Debug configuration complained that "Debug port forwarding not found". 谷歌告诉我,我需要一个添加debugPort进入到我的workspace.xml文件,但是当这样做,我运行/调试配置抱怨说,“调试端口转发未找到”。 Clicking "Fix" resulted in a container_settings.json file being created, which IntelliJ immediately informed me wasn't supported in 2017.3+, and that i should use command line options instead. 单击“修复”导致创建了container_settings.json文件,IntelliJ立即通知我在2017.3+中不支持该文件,我应该使用命令行选项。 However, I have no idea what those command line options should be. 但是,我不知道这些命令行选项应该是什么。

When I tried specifying the forwarding port in the Run/Debug configuration, the deploy log ended with Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix , which makes no freaking sense. 当我尝试在“运行/调试”配置中指定转发端口时,部署日志以Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix结尾Cannot retrieve debug connection: java.net.MalformedURLException: unknown protocol: unix ,这没有什么奇怪的意义。

Help! 救命!

You can even use dcevm / HotswapAgent in dockerized application and modify code/resorces without restart. 您甚至可以在dockerized应用程序中使用dcevm / HotswapAgent并修改代码/资源,而无需重新启动。 Look at this project https://github.com/HotswapProjects/hotswap-docklands 看看这个项目https://github.com/HotswapProjects/hotswap-docklands

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 intellij idea 中调试 JDK docker 容器? - How to debug a JDK docker container in intellij idea? 如何在Intellij IDEA 2018.2中以Java代码而不是Java脚本调试GWT 2.8.1 - How debug GWT 2.8.1 in Intellij IDEA 2018.2 as java code instead java script 如何使用 IntelliJ IDEA 调试部署在集群环境中的 Java 应用程序? - How do I debug a Java application deployed in a cluster environment using IntelliJ IDEA? 如何查看 Intellij Idea 中运行的实际命令 (java)? - How can I see the actual commands (java) running in Intellij Idea? Intellij idea Debug:应用程序正在运行 - Intellij idea Debug: the application is running 如何在 Intellij IDEA 中使用 JRebel 进行调试 - How can I debug with JRebel in Intellij IDEA 从IntelliJ IDEA远程调试Docker容器中的Java 9 - Remote debugging Java 9 in a docker container from IntelliJ IDEA 如何使用 IntelliJ 调试在 Docker 中运行的应用程序? - How to debug an application running in Docker with IntelliJ? 如何创建在 IntelliJ Idea 中编译的 Java 子 class? - How do I create a Java child class that compiles in IntelliJ Idea? 如何解决 IntelliJ IDEA 中 Java 文件的依赖冲突? - How do I resolve dependency conflict for a Java file in IntelliJ IDEA?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM