Configure Docker Compose for Remote Debugging - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

Edit the debug-community-docker-compose.yml file by adding the following ports and environment settings:

services:
    alfresco:
        image: alfresco/alfresco-content-repository-community:7.1.0-M1
        mem_limit: 1500m
        ports:
            - 8000:8000
        environment:
            CATALINA_OPTS: "
                -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n
                "
            JAVA_TOOL_OPTIONS: "
            ...

The -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n option tells the JVM to start with the port 8000 open, ready to accept remote debugging sessions.

Note that the remote debugging configuration is done via the CATALINA_OPTS variable instead of JAVA_TOOL_OPTIONS or JAVA_OPTS as we need to instruct Tomcat running inside the Docker container, not the JVM directly (this is a big difference from the IntelliJ tutorial).

We need to also open the remote debug port from the container to the host, so that http://localhost:8000 will be propagated to the container and Tomcat. This is done with the ports configuration.