Learn how New Relic can be effectively used to monitor Dockerized applications in a production environment. Walk through a step-by-step integration, which explains key monitoring metrics and demonstrates how organisations can leverage New Relic’s alerting, logging, and visualisation capabilities to maintain optimal system performance.
In the era of cloud-native applications and microservices, efficient monitoring is essential for ensuring performance, availability, and reliability. As businesses scale their applications using Docker and Kubernetes, traditional monitoring techniques struggle to provide deep visibility into containerised workloads, distributed applications, and dynamic infrastructures. This calls for robust observability solutions that offer real-time insights, proactive alerting, and performance diagnostics.
New Relic, a powerful application performance monitoring (APM) tool, addresses this need by providing end-to-end observability across containers, microservices, and infrastructure components. It seamlessly integrates with Dockerized environments, offering deep insights into application behaviour, resource utilisation, network performance, and security vulnerabilities.
Key features of New Relic
New Relic is a comprehensive observability platform particularly valuable for containerised environments like Docker and Kubernetes. Unlike traditional monitoring solutions that focus only on basic CPU, memory, and network metrics, New Relic delivers a holistic view of system health by integrating application performance monitoring (APM), distributed tracing, infrastructure monitoring, and intelligent alerting into a single platform. This enables DevOps and site reliability engineering (SRE) teams to detect issues proactively, optimise resource utilisation, and prevent downtime in microservices-based architectures. Here are its key features.
Real-time application performance monitoring (APM): Continuously tracks application response times, error rates, and transaction throughput to detect performance bottlenecks.
Infrastructure monitoring: Provides deep visibility into containerised workloads, virtual machines, cloud platforms (AWS, Azure, GCP), and on-premises infrastructure.
Distributed tracing: Traces end-to-end user requests across microservices to help pinpoint slow dependencies, failures, and latency issues.
Logs in context: Unifies logs, metrics, and traces in a single view, enabling efficient root cause analysis and troubleshooting.
Intelligent alerts and anomaly detection: Uses machine learning-powered insights to detect anomalies, proactively triggering alerts before issues escalate.
Custom dashboards and visualisation: Provides interactive dashboards that allow teams to monitor key performance indicators (KPIs) and system trends in real time.
Auto-instrumentation and OpenTelemetry support: Seamlessly integrates with open-source observability tools like Prometheus, Grafana, and OpenTelemetry, ensuring flexible monitoring across hybrid and multi-cloud environments.
Integrating New Relic with Dockerized applications
Due to space constraints, images for all the integration steps have not been given here. Interested readers can visit the GitHub repository for the detailed report and project at https://github.com/rishithaiiitb/ImageCaptioning.git.
The image captioning system was developed and deployed by integrating a machine learning model into the application, following DevOps best practices. This system generates descriptive text for images, enhancing accessibility for visually impaired individuals, automating content creation, and improving search engine optimisation. Following its successful deployment, New Relic was integrated to enable real-time monitoring and performance optimisation.
Setting up a New Relic account and licence key
Before integrating New Relic with a Dockerized application, it is essential to ensure that the application is fully containerised and running smoothly within Docker. Additionally, the containers must be configured with the appropriate network settings to allow seamless communication between services.
The first step in the integration process is to create a New Relic account and obtain a licence key, which is required to establish a connection between the New Relic agent and the New Relic platform for collecting application performance data. Here are the steps for that.
Create a New Relic account: Visit the New Relic Signup Page to register for an account. Provide the necessary details and complete the signup process. Once registered, log in to your New Relic dashboard.
Access the New Relic dashboard: After logging in, navigate to the New Relic dashboard, where all monitoring entities and configurations are available.
Generate a licence key: Go to the API Keys section in your profile settings. Navigate to the License Key tab and select Create a New License Key. Copy the generated licence key, as it will be required for agent configuration in later steps.
This licence key acts as an authentication token that allows the New Relic agent to collect real-time application performance data and send it securely to the monitoring dashboard.
Java agent for backend monitoring
The backend of the application is built using Spring Boot and Java running within the Docker container. To ensure real-time performance monitoring and proactive issue detection, the New Relic Java agent is integrated into the application.
This agent provides detailed performance insights, including:
- Response times, error rates, and throughput
- Database query performance and execution times
- JVM metrics such as garbage collection, heap memory, and thread activity
- External service interactions and API response times
By monitoring these critical metrics, the New Relic Java agent helps identify performance bottlenecks, optimises resource utilisation, and enhances application reliability. Here is a step-by-step guide for integrating the New Relic Java agent with a Spring Boot backend running in Docker.
Step 1: Select the Java Agent in New Relic
- Navigate to the Integrations & Agents section in New Relic.
- Choose Java as the integration option.
Step 2: Configure the licence key
- Select the environment where the application is running (in this case, Docker).
- Enter the New Relic licence key generated earlier.
- Click Continue to proceed.
Step 3: Choose the operating system
- Specify the operating system of the application (for this setup, select Linux).
Step 4: Download and install the Java agent
- Download the Java agent using the following command:
curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
- Extract the downloaded package.
Step 5: Configure the Java agent
- Assign a custom application name in the New Relic dashboard.
- Download the New Relic configuration file containing your API key.
- Place this file inside the extracted Java agent directory.
Step 6: Set environment variables in Docker
To allow the New Relic agent to collect metrics, modify the Docker and Docker Compose files by setting environment variables:
ENV NEW_RELIC_LICENSE_KEY= YOUR LICENSE KEY ENV NEW_RELIC_APP_NAME=image-captioning-backend
Step 7: Update the Dockerfile
- Add the New Relic Java agent to the Dockerfile.
- Modify the startup command in the Docker file to include the New Relic agent:
CMD [“java”, “-javaagent:/newrelic/newrelic.jar”, “-jar”, “imagecaptioning.jar”]
Step 8: Build and deploy the updated Docker container
- Rebuild the Docker image:
docker build -t my-springboot-app
- Run the container:
docker run -d -p 8080:8080 my-springboot-app
- Navigate to the New Relic dashboard and verify that performance metrics are being received.
Once the backend container is successfully integrated with New Relic, the dashboard provides valuable insights such as:
- Response times and throughput: Identifies slow requests and API bottlenecks.
- Error rates and exceptions: Tracks application failures and logs stack traces.
- Database query performance: Monitors slow SQL queries and optimises database calls.
- External service interactions: Ensures seamless API communication and third-party integration performance.
We can view all the metrics by navigating through the sections in the left-side panel of the dashboard as shown in Figures 1 and 2.


By leveraging real-time monitoring with the New Relic Java agent, developers can detect and resolve issues faster, optimise backend performance, and ensure a seamless user experience.
Python agent for model monitoring
The machine learning model, developed using Python, is deployed within a Docker container running a Django application. To ensure optimal performance, the New Relic Python agent was integrated, providing real-time monitoring of model inference times, tracking Python process metrics, identifying bottlenecks, and ensuring the model serves predictions efficiently.
The following steps outline the process of integrating the New Relic Python agent with a Dockerized machine learning model hosted on Django.
Step 1: Creating a New Relic Python agent
Navigate to the Integrations & Agents section in New Relic.
- Select Python as the programming language.
- Choose the environment where the application is running (Docker in this case) and click Continue.
Step 2: Selecting the application type
- Choose whether the Python model is a web application or a non-web application based on its functionality.
Step 3: Installing the New Relic Python agent
a. Ensure all required dependencies are listed in requirements.txt.
b. Install the New Relic Python agent using the command:
pip install newrelic
Step 4: Configuring New Relic for Python
- Create a New Relic configuration file by executing the command:
newrelic-admin generate-config your_licence_key newrelic.ini
- Customise the newrelic.ini file as required for the monitoring setup.
Step 5: Specifying the framework
- Select the framework used for hosting the model (Django in this case).
Step 6: Integrating New Relic with Docker
- Modify the Dockerfile to:
a. Copy the New Relic configuration file into the container:
COPY newrelic.ini /newrelic.ini
b. Copy and install the dependencies:
COPY requirements.txt . RUN pip install --no-cache-dir -r ./requirements.txt
c. Use the New Relic admin tool to wrap the Django runserver command:
ENTRYPOINT [“newrelic-admin”, “run-program”]
Step 7: Verifying the integration in the dashboard
- Select the Python server from the New Relic dashboard.
- Build and run the Docker container.
- Navigate to the New Relic dashboard to confirm the successful connection and review real-time metrics, as shown in Figure 3.

Browser monitoring for the frontend application
To ensure an optimal user experience, New Relic browser monitoring was integrated into the frontend application. This monitoring solution helps track real-user interactions, page load times, JavaScript errors, and frontend performance metrics, providing deep insights into how the application behaves in the user’s browser.
Since the frontend application is built using React and deployed in a Docker container, the New Relic browser agent was added to capture real-time performance analytics. The following steps outline the integration process.
Step 1: Enable browser monitoring in New Relic
- Navigate to Integrations & Agents in the New Relic dashboard.
- Select Browser Monitoring as the integration type.
Step 2: Choose an integration method
- Choose how the New Relic browser agent should be integrated.
- Click Continue to proceed.
Step 3: Configure the browser monitoring agent
- Assign a name to the frontend application for tracking in New Relic.
- Define the monitoring settings based on the application’s needs.
Step 4: Add the New Relic agent script to the HTML file
- Copy the JavaScript snippet provided by New Relic.
- Insert the script into the <head> section of the HTML template in the frontend application.
Step 5: Build and deploy the frontend application
- Build the Docker image for the frontend:
docker build -t my-frontend-app
- Run the Docker container:
docker run -d -p 3000:3000 my-frontend-app
Navigate to the New Relic browser monitoring section and verify that the frontend application appears in the dashboard as shown in Figures 4 and 5.


Key performance metrics captured
Once the browser monitoring integration is complete, New Relic collects real-time data on the following:
- Page load times: Measures how quickly pages render for users.
- JavaScript errors: Captures and categorises errors affecting the user experience.
- User interactions: Tracks clicks, navigation, and engagement patterns.
- Frontend performance: Monitors bottlenecks affecting responsiveness.
This data is visualised in the New Relic dashboard, enabling frontend teams to optimise performance, debug errors faster, and enhance the overall user experience.
Infrastructure monitoring
Infrastructure monitoring is essential for tracking resource usage and performance across all containers in the system, including frontend, backend, and model services. New Relic’s infrastructure monitoring provides real-time insights into host-level metrics such as CPU usage, memory consumption, disk I/O, and network activity, along with container-specific metrics like per-container CPU and memory utilisation, uptime, and restart counts. This comprehensive monitoring ensures stability and efficiency across all deployed services. Here are the steps to set up infrastructure monitoring with New Relic.
- Install the New Relic infrastructure agent using the following command:
curl -Ls https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo apt-key add -
- Add the New Relic Repository based on the appropriate Linux version:
echo “deb [arch=amd64] https://download.newrelic.com/infrastructure_agent/linux/apt jammy main” | sudo tee /etc/apt/sources.list.d/newrelic-infra.list
- Update the package list and install the agent:
sudo apt-get update; sudo apt-get install newrelic-infra -y
- Configure the infrastructure agent:
sudonano /etc/newrelic-infra.yml
- Add the following configuration:
1. license_key: YOUR_LICENSE_KEY 2. enable_docker: true
- Restart the agent to apply the configuration:
sudosystemctl restart newrelic-infra
- Once the agent is installed and configured, navigate to New Relic’s infrastructure monitoring section to view all running Docker containers on the host as shown in Figure 6.

Container monitoring and metrics
After setting up the agent, New Relic automatically detects and monitors all running containers on the host machine. The dashboard in Figure 7 provides a comprehensive overview of container metrics including:

- CPU usage and memory consumption for each container
- Disk I/O and network activity metrics
- Container uptime and restart counts
- Logs and performance data for frontend, backend, and model services
This enables real-time monitoring of the containerised environment, facilitating proactive issue detection and performance optimisation.
The integration of New Relic significantly improves observability, performance management, and troubleshooting across the backend, frontend, machine learning model, and infrastructure. With real-time insights and proactive monitoring, the system ensures high availability and optimal performance.
New Relic effectively tracks backend response times, error rates, and database performance, while frontend monitoring analyses user interactions, page load times, and JavaScript errors. The machine learning model, hosted on Django and Docker, is continuously monitored for latency and resource usage, ensuring AI-driven components remain efficient. Infrastructure monitoring provides visibility into CPU, memory, disk, and network usage, helping prevent bottlenecks.
With historical performance analysis and proactive alerts, the system enables trend identification, rapid issue resolution, and enhanced stability.
As seen here, modern observability tools are extremely important for maintaining scalable, high-performance applications. Real-time monitoring, intelligent alerting, and historical analysis play a crucial role in efficient troubleshooting, system resilience, and better user experiences in containerised environments.