java - debug spring-boot in docker -


for reason have issues connecting remote debug spring-boot app running inside docker. start java app with:

java -xdebug -xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar app.jar 

for docker expose these ports on docker-compose:

ports: - "8080:8080" - "8000:8000" 

however, debugger not able connect on port 8000. works when run server locally not inside docker. idea why?

docker ps output:

container id        image                       command                created               status              ports                                            names 0d17e6851807        pocmanager_manager:latest   "/bin/sh -c 'java -d   3 seconds ago       2 seconds        0.0.0.0:8000->8000/tcp, 0.0.0.0:8080->8080/tcp   pocmanager_manager_1    35ed2e2c32bc        redis:latest                "/entrypoint.sh redi   14 seconds ago      13 seconds       0.0.0.0:6379->6379/tcp                           pocmanager_redis_1 

hi faced same problem.

i added following entrypoint in dockerfile:

"-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

now looks this:

from java:8 volume /tmp add realname*.jar app.jar expose 4786 run sh -c 'touch /app.jar' entrypoint ["java","-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n","-djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 

i did not exposeport 8000 in dockerfile.

hope helps.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -