Help Docs

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.

Video

Here's a quick video on how to install a Site24x7 APM Insight Java agent in a Docker container.

Please follow the steps below to achieve the same:

  1. Go to APM > APM Insight > Applications and click the Java icon.
  2. Click Download to download the APM Insight Java agent ZIP file (apminsight-javaagent.zip).
  3. Place it in the same local directory as your Spring Boot application JAR file.
    In this example, Spring Boot is the application used.
  4. Extract the ZIP file and locate the agent's jar and configuration files.
  5. Open the apminsight.conf file in any text editor to include license.key, application.name, and proxy details.
    You can get the license key from the Site24x7 APM Insight Java agent page.
  6. Next, open the Dockerfile with any text editor.
    The screenshot below is just an example; your actual Dockerfile content may differ. Please make the necessary changes.
    DockerFile
  7. You can use the COPY command to copy all the APM Insight Java agent files to a directory inside the target container.
    Using COPY command to copy all the APM Insight Java agent files to a directory inside the target container
  8. Add the following argument to the startup command (ENTRYPOINT or RUN command):
    -javaagent:[agent_directory_full_path]/apminsight-javaagent.jar
    This Java agent argument helps start the APM Insight Java agent along with the application.
    Adding argument to the startup command

  9. You can now use the updated Dockerfile to create your container image.
    Use the updated Dockerfile to create your container image
  10. Once the image is ready, you can start your application by spawning containers using the Docker image you created.
    Start your application by spawning containers using the Docker image you created
  11. Once the application is up and receiving requests, you can view the monitor under APM > APM Insight > Applications.
    View monitor

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.


Related articles

How to install various APM Insight agents in a Docker container
.NET | PHP | Node.js | Python

How to install various APM Insight agents in a Kubernetes environment
Java | .NET | PHP | Node.js | Python

Was this document helpful?

Shortlink has been copied!