简体   繁体   中英

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.

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 . 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". 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. 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.

Help!

You can even use dcevm / HotswapAgent in dockerized application and modify code/resorces without restart. Look at this project https://github.com/HotswapProjects/hotswap-docklands

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM