This page installs the NRDOT Collector on a Linux host, configures it to collect Docker container metrics, and verifies data reaches New Relic.
Compatibility and requirements
Supported
- Docker Engine API version 1.25 or later
You need
- A valid New Relic license key
- Access to the Docker socket (typically
/var/run/docker.sock) - Network access from the host to the Docker Engine socket and to a New Relic OTLP endpoint
- Read permissions on
/var/lib/docker/containers/for log collection (typically root or docker group membership)
Install NRDOT Collector
Tip
If you already have NRDOT Collector installed, skip this step and continue to Set up Docker socket permissions.
Other Linux distributions: For archive installations or other methods, see the NRDOT installation guide.
Set up Docker socket permissions
The collector needs access to the Docker socket to collect container metrics. Grant the collector user access to the Docker group.
$# Add nrdot-collector user to docker group$sudo usermod -aG docker nrdot-collector$
$# Verify the user was added$groups nrdot-collector$
$# Restart Docker to apply group changes$sudo systemctl restart docker$
$# Test Docker socket access$sudo -u nrdot-collector docker psIf the test command succeeds and shows your containers, you've configured permissions correctly.
If this reports permission denied instead of listing containers, see Permission denied errors.
Configure the collector
Important
Standalone vs. Combined monitoring: This configuration monitors Docker containers only. If you also need host metrics (CPU, memory, disk) or system logs, use the NRDOT Collector's default configuration which includes the hostmetrics and filelog receivers, and add the docker_stats receiver to it.
Create /etc/nrdot-collector/docker-stats-config.yaml with the following content:
receivers: # Docker Stats Receiver - collects container metrics docker_stats: endpoint: unix:///var/run/docker.sock collection_interval: 15s timeout: 5s api_version: "1.25" # Most metrics required for New Relic UI are enabled by default: # CPU: container.cpu.usage.total, container.cpu.utilization # Memory: container.memory.usage.total, container.memory.percent # Network: container.network.io.usage.tx_bytes, container.network.io.usage.rx_bytes # container.network.io.usage.tx_dropped, container.network.io.usage.rx_dropped # Storage: container.blockio.io_service_bytes_recursive # # The following metrics need to be explicitly enabled: metrics: # Required for New Relic UI container.pids.count: enabled: true # Additional network error metrics container.network.io.usage.tx_errors: enabled: true container.network.io.usage.rx_errors: enabled: true
processors: # Batch processor optimizes data transmission batch: timeout: 10s send_batch_size: 1024
# Transform processor - removes descriptions and units transform: metric_statements: - context: metric statements: - set(description, "") - set(unit, "")exporters: otlp_http: endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT:-https://otlp.nr-data.net} headers: api-key: ${env:NEW_RELIC_LICENSE_KEY} compression: gzip
service: pipelines: metrics/docker: receivers: [docker_stats] processors: [transform, batch] exporters: [otlp_http]Configuration parameters
The following table describes the key configuration parameters for the docker_stats receiver and exporter:
| Parameter | Description |
|---|---|
endpoint (docker_stats) | Enter the path to the Docker socket the collector connects to. Default: unix:///var/run/docker.sock |
collection_interval | Set how often the collector scrapes container stats. Default: 15s |
timeout | Set how long the collector waits for the Docker Engine API to respond before giving up. Default: 5s |
api_version | Enter the Docker Engine API version your host supports. Default: 1.25 |
NEW_RELIC_LICENSE_KEY | Enter your New Relic license key. |
OTEL_EXPORTER_OTLP_ENDPOINT | Enter the New Relic OTLP endpoint for your region. See New Relic OTLP endpoints. |
Tip
Optionally, you can also collect logs from your containers. For configuration steps, see Advanced configuration.
Configure the systemd service:
Now you'll configure the NRDOT Collector service to use your Docker monitoring configuration and authentication credentials. This involves creating a systemd override to specify the custom config file and environment variables.
Create a systemd override directory:
bash$sudo mkdir -p /etc/systemd/system/nrdot-collector.service.dCreate an override configuration to use the Docker stats config. Replace
YOUR_LICENSE_KEYwith your New Relic license key andYOUR_OTLP_ENDPOINTwith the appropriate endpoint for your region:bash$cat <<EOF | sudo tee /etc/systemd/system/nrdot-collector.service.d/override.conf$[Service]$Environment="NEW_RELIC_LICENSE_KEY=YOUR_LICENSE_KEY"$Environment="OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTLP_ENDPOINT"$ExecStart=$ExecStart=/usr/bin/nrdot-collector --config=/etc/nrdot-collector/docker-stats-config.yaml$EOF
Tip
The empty ExecStart= line clears the default command before setting the new one. This ensures the collector uses only the Docker stats configuration instead of the default configuration.
Restart the collector
Reload systemd, enable and restart the collector:
$sudo systemctl daemon-reload$sudo systemctl enable nrdot-collector$sudo systemctl restart nrdot-collector$
$# Verify the collector is running$sudo systemctl status nrdot-collectorVerify your install
Within 5 minutes of completing the install, confirm data reaches New Relic.
- Go to one.newrelic.com > All Entities and search by hostname or container name. Your Docker containers should appear as entities.
- Run this NRQL query and confirm it returns at least 1 row:FROM Metric SELECT count(*) WHERE container.runtime = 'docker' SINCE 10 minutes ago
If you don't see data within 5 minutes, see Docker monitoring troubleshooting.
Your Docker containers are reporting data. Want to collect logs too? Advanced configuration covers log collection setup.
Related articles
- Advanced configuration: Optional configuration beyond the minimum setup, including log collection
- Docker metrics reference: Complete metric and attribute reference, with alerting recommendations
- NRQL alert conditions: Set up proactive alerting on container metrics