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:
- Go to APM > APM Insight > Applications and click the Java icon.
- Click Download to download the APM Insight Java agent ZIP file (apminsight-javaagent.zip).
- Place it in the same local directory as your Spring Boot application JAR file.
In this example, Spring Boot is the application used.
- Extract the ZIP file and locate the agent's jar and configuration files.
- 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.
- 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.
- You can use the COPY command to copy all the APM Insight Java agent files to a directory inside the target container.
- Add the following argument to the startup command (ENTRYPOINT or RUN command):
-javaagent:[agent_directory_full_path]/apminsight-javaagent.jarThis Java agent argument helps start the APM Insight Java agent along with the application.
- You can now use the updated Dockerfile to create your container image.
- Once the image is ready, you can start your application by spawning containers using the Docker image you created.
- Once the application is up and receiving requests, you can view the monitor under APM > APM Insight > Applications.
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.
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