如何调试在vs代码中用java编写的docker容器(storm crawler)?
我无法获得如何在vs代码中调试docker容器(正在运行storm crawler)?我试着寻找如何调试在vs代码中用java编写的docker容器(storm crawler)?,java,debugging,visual-studio-code,docker-container,stormcrawler,Java,Debugging,Visual Studio Code,Docker Container,Stormcrawler,我无法获得如何在vs代码中调试docker容器(正在运行storm crawler)?我试着寻找https://code.visualstudio.com/docs/containers/debug-common 和其他https://github.com/DigitalPebble/storm-crawler/wiki/Debug-with-Eclipse。 但我没有做任何事情,比如如何配置launch.json文件 有人能告诉我怎么做吗?如果你试图使用VSCode提供的Docker调试器,我
https://code.visualstudio.com/docs/containers/debug-common
和其他https://github.com/DigitalPebble/storm-crawler/wiki/Debug-with-Eclipse
。
但我没有做任何事情,比如如何配置launch.json文件
有人能告诉我怎么做吗?如果你试图使用VSCode提供的Docker调试器,我想你会遇到奇怪的问题。文件说明 Docker扩展目前支持调试Docker容器中的Node.js、Python和.NET核心应用程序 根据我的经验,编辑Java代码和Dockerfile,然后重建和重新运行容器有助于我进行编辑,并在代码中查找任何问题
Dockerhub可能也是搜索帮助的好地方这对我来说解决了问题: 将launch.json文件写入为:
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Attach) - Remote",
"request": "attach",
"hostName": "localhost",
"port": 8000,
}
]
}
并将其连接至storm crawler的docker容器,如下所示:
version: "3"
services:
storm-jar:
command: bash -c "storm kill crawler -w 0 ; storm local target/stormcrawler-1.0.jar org.apache.storm.flux.Flux es-crawler.flux --sleep 86400000"
environment:
- STORM_JAR_JVM_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
ports:
- 8000:8000
其中在storm crawler的github的wiki页面上提供了调试storm crawler的环境:https://github.com/DigitalPebble/storm-crawler/wiki/Debug-with-Eclipse