Help APM APM Insight using Java Agent Install Java Agent in a Docker Container

Installing the Java agent in a Docker container

Installing Java agents in containerized application environments such as Docker is similar to installing them in regular server environments, except that the agent files and configurations must be part of the container image itself.

Please follow the steps below to achieve the same:

  1. Download the APM Insight Java agent ZIP file (apminsight-javaagent.zip) and place it in the same local directory as your Spring Boot application JAR file.
  2. Extract the Java agent ZIP file and make changes to the apminsight.conf file to include license.key, application.name, agent.server.port, and proxy details.
  3. You need to copy all APM Insight Java agent files to a directory inside the target container. You can also use the COPY command, then add a JVM argument -javaagentto the ENTRYPOINT or RUN command. This Java agent argument helps start the APM Insight Java agent along with the application.

For Spring Boot applications:

  • Assume your Dockerfile is as follows:
    DockerFile of SpringBoot- Before
  • After you copy all APM Insight Java agent files to a directory inside the target container, the Dockerfile will look like this:DockerFile of SpringBoot- After

For Tomcat-based applications:

  • Assume your Dockerfile is as follows:
    DockerFile of Tomcat- Before

  • You can modify your Dockerfile as follows:
    DockerFile of Tomcat- After

Follow the respective configurations for any other containerized app servers.

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help APM APM Insight using Java Agent Install Java Agent in a Docker Container