Deploying NewRelic Agent in Docker Image using Dockerfile for Tomcat and Java

It doesn’t actually matter where you put the New Relic agent. All that matters is that the agent and its support files (including newrelic.yml) are in the same folder, and that you set the -javaagent property of your JVM to point to the location of the newrelic.jar file.

A very important thing to know: your startup script (the one which contains the command that starts your application server) must include Java’s built-in argument called “-javaagent”, and the value of that argument must be the location of wherever you unzipped the newrelic agent. For example, “-javaagent:/usr/local/tomcat/newrelic/newrelic.jar”.

Let’s say that you were testing out deploying a single Java web application, using Docker and New Relic. These 2 files might be all you need:

Rajesh Kumar
Follow me