NGINX Agent Docker Support
Learn how to use the NGINX Agent in a Docker environment.
To collect metrics about the Docker container that the NGINX Agent is running in, the NGINX Agent uses the available cgroup files to calculate metrics like CPU and memory usage.
The NGINX Agent supports both versions of cgroups.
The following system metrics are not supported when running the NGINX Agent in a Docker container. The NGINX Agent returns no values for these metrics:
If no memory limit is set when starting the Docker container, then the memory limit that’s shown in the metrics for the container will be the total memory of the Docker host system.
If a warning message similar to the following example is seen in the NGINX Agent logs, the swap memory limit for the Docker container is greater than the swap memory for the Docker host system:
Swap memory limit specified for the container, ... is greater than the host system swap memory ...
system.swap.total metric for the container matches the total swap memory for the Docker host system instead of the swap memory limit specified when starting the Docker container.
If a warning message similar to the following example is seen in the NGINX Agent logs, the Docker host system does not have cgroup swap limit capabilities enabled. To enable these capabilities, follow the steps below.
Unable to collect Swap metrics because the file ... was not found
Run the following command to see if the cgroup swap limit capabilities are enabled:
$ docker info | grep swap WARNING: No swap limit support
To enable cgroup swap limit capabilities, refer to this Docker guide: Docker - Linux post-installation steps.