The New Relic Infrastructure agent automatically collects metrics for Docker containers running on instrumented hosts. For Docker containers, the Processes page indicates which processes are containerized and the container ID for each Docker process. Infrastructure also captures any Docker labels associated with your containers, for filtering in Infrastructure and building Insights queries.
Infrastructure supports Docker versions 1.12 or higher.
Install for Docker
Following the standard Infrastructure installation procedures for Linux or Windows, install the Infrastructure agent on the parent host (not inside the Docker container). Collecting Docker metrics requires no additional configuration.
The ability to report on Docker container information like container name, label, image ID, etc. depends on the Docker daemon. Using
docker-containerd-shim to run containers without the Docker daemon will impair the agent's ability to collect some metrics used in grouping data.
Adding Docker support in non-root agents
If you're running the Linux agent as a privileged or unprivileged user follow these instructions:
Check that your system has a group named docker with group permissions to the
ls -l /var/run/docker.sock
srw-rw----. 1 root docker 0 Dec 19 12:26 /var/run/docker.sock
If this group does not exist (some Linux distributions do not create the docker group by default), you need to create it manually and assign the ownership to the docker socket:
sudo groupadd docker
sudo chown root:docker /var/run/docker.sock
Provide user access to the Docker control socket to the
nri-agentuser. To do this, you can add the
nri-agentuser to the
sudo usermod -aG docker nri-agent
View Docker metrics in Infrastructure
The Infrastructure Processes page lists Docker processes alongside other running processes. To identify Docker processes:
- Look for images with an image ID listed in the Image column.
- Filter the page to view only specific Docker containers.
- View only Docker processes
To view all Docker containers, type
containedin the in-page filter, then select
truefrom the dropdown. The Processes page then shows only containerized processes.
- View each instance of a Docker image
To view all copies of a Docker container across your environment, click on its image ID in the Image column. The Processes page then shows only processes that share that unique image ID.
- View resource usage for each Docker image
To view results grouped by Docker image (for example, to identify images that generate higher CPU load), select
containerImageNamefrom the Group By field.
- View containers associated with a Docker label
To view only Docker containers with a particular Docker label, type
containerLabel_in the in-page filter, then select your label from the dropdown list. For example,
View Docker metrics in Insights
You can also view Docker metrics in Insights by querying these attributes in the
For example, to see how many containers are associated with each Docker image:
SELECT uniqueCount(containerId) FROM ProcessSample FACET containerImageName SINCE 1 HOUR AGO TIMESERIES