• /
  • EnglishEspañolFrançais日本語한국어Português
  • Log inStart now

Install the Node.js agent for Docker

|View as Markdown

You can use our Node.js agent to instrument Node.js applications deployed in Docker containers. This document explains how to build, configure, and deploy your Dockerized Node.js application that you've instrumented with New Relic.

If you need general help with the Node.js agent installation, see our main installation instructions.

Instrument your container

Caution

Don't include your license key in your Dockerfile or Docker image. For more information, see our documentation on license key security.

By making a few configuration changes and adding New Relic environment variables to your existing Dockerfile, you can instrument your Dockerized app with our Node.js agent.

  1. Add newrelic to your package.json:

    npm install newrelic --save
  2. Inject the agent in your node start command to instrument your application.

  1. Build your Docker image the way you normally do.

  2. To run your Docker app with the agent enabled, add your and app name to your docker run command as environment variables:

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

Did this doc help with your installation?

Other configuration options

In addition to setting your application name or license key, you can set other configuration options by starting your container with the -e option.

Copyright © 2026 New Relic Inc.

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