--- title: "Java APM with Docker" slug: "java-apm-with-docker" description: "Learn how to install Stackify's Java APM Profiler in Docker or Docker Swarm for monitoring. Follow easy steps to enable and verify the setup." updated: 2020-05-05T22:15:08Z published: 2020-05-05T22:15:08Z canonical: "docs.stackify.com/java-apm-with-docker" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.stackify.com/llms.txt > Use this file to discover all available pages before exploring further. # Java APM with Docker This document details how to install the **Java APM Profiler** in your **Java** application running on **Docker** or **Docker Swarm**. ## Prerequisite Follow the [Retrace Docker Install](/docs/retrace-docker-install) Guide. ## Java Docker Setup #### Dockerfile Configuration Adjust your **Dockerfile** to include the Java Profiler: ``` RUN mkdir -p /stackify-java-apm && \ cd /stackify-java-apm && \ wget https://download.stackify.com/stackify-java-apm/stackify-java-apm-latest.tar.gz; tar -zxvf stackify-java-apm-latest.tar.gz; rm stackify-java-apm-latest.tar.gz && \ ./install.sh ``` #### Enabling the Java Agent Follow **[Enable the Stackify Java Profiler](/docs/java-apm-with-linux#enable-the-stackify-java-profiler)** instructions based on the application server being used. **Note:** Adjust the Java Profiler path to: `/stackify-java-apm/stackify-java-apm.jar`. ## Running your Application Start your application with the `stackify` shared volume. Customize the `STACKIFY_APPLICATION_NAME` and `STACKIFY_ENVIRONMENT_NAME` values. ``` docker run -v stackify:/usr/local/stackify \ --env STACKIFY_APPLICATION_NAME="My Java Application" \ --env STACKIFY_ENVIRONMENT_NAME="Production" \ [your-application-image] ``` ## Verify Make application requests, you can then verify results in the Retrace dashboard. ## Troubeshooting - Running in **Docker Swarm** requires that `STACKIFY_DOCKER_ENABLED` be set when running your application. This can be done using `-DSTACKIFY_DOCKER_ENABLED=true`.