Java APM with Docker
  • Updated on 07 Nov 2019
  • 1 minute to read
  • Contributors
  • Print
  • Share
  • Dark
    Light

Java APM with Docker

  • Print
  • Share
  • Dark
    Light

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 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 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

docker run -v stackify:/usr/local/stackify [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.
Was this article helpful?