Follow the steps below to install the APM Insight Java agent in a Docker container:
Download the latest APM Insight Java agent (apminsight-javaagent.zip) and extract it to a local folder.
Ensure that the apminsight-javaagent.jar, apminsight-javaagent-api.jar, and the configuration files (like apminsight.conf) are present in the extracted agent directory.
Edit the apminsight.conf file to include your license key, APM server URL, and application name:
Replace the following placeholders with the actual values:
Note: For alternate configuration using Java System Properties, refer to our guide.
Copy the agent and configure the startup options:
Replace the following placeholders with the actual values:
Save the Dockerfile, rebuild your Docker image, and start the container. Once the container is running and your application is accessed, data will begin appearing under the APM Insight → Applications section in the Applications Manager web console.
Here’s a sample Dockerfile incorporating the Java agent:
FROM tomcat
COPY sample.war /usr/local/tomcat/webapps/
# Add the APM Insight agent
RUN mkdir -p /usr/local/tomcat/apminsight
ADD ./apminsight/ /usr/local/tomcat/apminsight/
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/apminsight/apminsight-javaagent.jar"
EXPOSE 8080
CMD ["catalina.sh","run"]
Note: The -javaagent parameter is required for the agent to load. This method should work across application servers, but may need tweaks depending on your environment.
Thank you for your feedback!