I'm trying to enable remote debugging for one of the services included in my integration test. Most of the tests work fine, however if a test fails it is difficult to debug one of the other services. The (simplified) structure of the integration test is as follows:
Service A (service under test) -> GraphQL service -> Stubbed REST services
I'm using the following setup:
Service A docker-compose.yml
version: '3.5'
services:
rest-stubs:
image: rest-stubs:1.2.3
container_name: rest-stubs
ports:
- "8082:8080"
graphql-service:
image: graphql-service:1.2.3
container_name: graphql-service
ports:
- "8083:8080"
- "5005:5005"
environment:
- some.stub-url=http://rest-stubs:8080/some-stub-url
Dockerfile of graphql-service:
FROM graphql-service
EXPOSE 8080 8080
EXPOSE 5005 5005
ADD app/target/service-*-exec.jar /app/spring-boot-service.jar
CMD ["-java -agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=n \
-jar /app/spring-boot-service.jar"]
When I perform the integration test located in service A, the services defined in the docker-compose.yml spin up. I would have expected to be able to connect to the graphQL service' remote debugging port on 5005, however I receive a Unable to open debugger port (localhost:5005): java.net.ConnectException "Connection refused (Connection refused)
exception.
Does anyone know how I can properly remote debug a docker service?