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:
- 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.
- 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.
- 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:
- After you copy all APM Insight Java agent files to a directory inside the target container, the Dockerfile will look like this:
For Tomcat-based applications:
- Assume your Dockerfile is as follows:
- You can modify your Dockerfile as follows:
Follow the respective configurations for any other containerized app servers.