# Install APM Insight Java Agent in Docker Follow the steps below to install the APM Insight Java agent in a Docker container: ## Step 1. Download and extract the agent Download the latest [APM Insight Java agent](https://www.manageengine.com/products/applications_manager/apm-insight-agent-installation.html) (*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. ## Step 2. Configure the agent Edit the ***apminsight.conf*** file to include your license key, APM server URL, and application name: ```properties license.key=[LICENSE_KEY] apm.host=http://[HOST]:[PORT] application.name=[APP_NAME] ``` Replace the following placeholders with the actual values: - *[LICENSE_KEY]* — License key from Applications Manager APM Insight tab - *[HOST]*/*[PORT]* — APM Manager host and port - *[APP_NAME]* — The application’s name **Example:** ```properties license.key=APMI_74447444b... apm.host=http://apm-prod-server:9090 application.name=Docker_Server ``` **Note:** For alternate configuration using Java System Properties, refer to the [guide](https://www.manageengine.com/products/applications_manager/help/apm-insight-java-agent-configure-system-properties.html). ## Step 3. Modify your Dockerfile Copy the agent and configure the startup options: ```dockerfile # Create agent folder RUN mkdir -p /apminsight # Add agent files ADD / /apminsight/ # Activate agent on startup ENV JAVA_TOOL_OPTIONS="-javaagent:/apminsight/apminsight-javaagent.jar" ``` Replace the following placeholders with the actual values: - ** — Your application folder in the container - ** — Local folder with extracted agent files **Note:** **JAVA_TOOL_OPTIONS** is a JVM-recognized environment variable, automatically read by the JVM at startup regardless of base image or entrypoint script (Tomcat, plain `java -jar`, Spring Boot, etc.). Use this single approach for all Docker deployments. ## Step 4. Build and run 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. **Note:** - For secure connections, use an HTTPS APM URL (ensure certificates are valid): *https://apm-prod-server:8443*. - To support APM Manager failover (for Java Agent v6.8 and above), specify multiple hosts: *apm.host=http://apm-A:9090,http://apm-B:9090* ## Example (Tomcat) Here’s a sample Dockerfile incorporating the Java agent: ```dockerfile 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_TOOL_OPTIONS="-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.