• /
  • EnglishEspañolFrançais日本語한국어Português
  • EntrarComeçar agora

Install the Ruby agent in Docker

|View as Markdown (English)

Install the New Relic Ruby agent in a Docker container. Install the agent within each container you want to monitor.

Prerequisites

Requirement

Details

New Relic account

You need a New Relic account and your . Have it ready before you begin.

Ruby version

See Ruby agent requirements and supported frameworks for supported Ruby versions.

Docker

Docker installed with a Ruby base image.

Add the gem to your Gemfile

Add the Ruby agent gem to your Gemfile:

gem 'newrelic_rpm'

Your Dockerfile should run bundle install as part of the build:

COPY Gemfile Gemfile.lock ./
RUN bundle install

Framework-specific notes:

  • Rails: Rails automatically calls Bundler.require, so newrelic_rpm is required during startup with no additional steps.
  • Roda or Sinatra: You must manually call require 'newrelic_rpm' in your application.
  • Other Rack apps: To use automatic browser monitoring, manually include the Rack middlewares provided by the agent.

Configure the agent

Pass your app name and license key as environment variables when running the container — do not hardcode them in your image:

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 set them via ENV in your Dockerfile:

ENV NEW_RELIC_APP_NAME="Your Application Name"

For all other configuration options, see Ruby agent configuration.

Verify data is flowing

Run your container and send at least two requests to your application. Wait 2–3 minutes, then open one.newrelic.com > APM and look for your app by name.

Dica

App not appearing? See No data appears (Ruby).

Copyright © 2026 New Relic Inc.

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