• /
  • EnglishEspañolFrançais日本語한국어Português
  • ログイン今すぐ開始

Install the Java agent in Docker

|View as Markdown (English)

This page covers installing the New Relic Java agent in a Docker container by adding the agent jar to your image and passing the -javaagent JVM argument at startup.

Compatibility and requirements

Supported

  • Java 8, 11, 17, 21, 24, 25, and 26 (Java 7 supported on agent v6.5.4 and earlier only)
  • Any Docker image running a Java application (Tomcat, Spring Boot, or similar) that accepts a -javaagent JVM argument
  • See compatibility and requirements for supported framework and library version ranges

Not supported

  • Running alongside other APM agents — the Java agent cannot guarantee correct behavior when another APM agent is active in the same JVM

You need

  • A New Relic account and
  • A JVM with SHA-2 (256-bit) SSL support
  • Docker installed with a Java application container

Install

Download newrelic-java.zip: [#install-step-1]

bash
$
curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
$
unzip newrelic-java.zip

Add the agent jar to your Dockerfile. The example below uses Tomcat — adjust the path for your app server:

RUN mkdir -p /usr/local/tomcat/newrelic
ADD ./newrelic/newrelic.jar /usr/local/tomcat/newrelic/newrelic.jar
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/newrelic/newrelic.jar"

Build your Docker image as usual.

Configure

Pass your app name and license key as environment variables when running the container:

bash
$
docker run -e NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY \
>
-e NEW_RELIC_APP_NAME="Your Application Name" \
>
YOUR_IMAGE_NAME:latest

You can also use ENV directives in your Dockerfile:

ENV NEW_RELIC_APP_NAME="Your Application Name"

For all other configuration options, see Java agent configuration.

Verify your install

Run your container and send at least two requests to your application. Wait 2–3 minutes and your app appears in APM & services.

If no data appears after five minutes, see No data appears (Java).

Copyright © 2026 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.