Deploy and Debug Tomcat with Docker in IDEA
Build Docker Image
Create docker-compose.yml and edit like following codes:
1 | tomcat: |
The key point in the config file is the two environment variables:
1 | JPDA_ADDRESS=8000 |
Caveat
You may set the JPDA_ADDRESS value *:8000, which makes Tomcat listen on 0.0.0.0 other than 127.0.0.1.
Run Docker Container
In the directory of docker-compose.yml, execute command:
1 | docker-compose up -d |
Debug in IDEA
- add a Remote Run Configuration

set a breakpoint in your program anywhere you like
swith to Run Configuration which setup in first step, and click debug