Skip to main content

Dockerstats Receiver

Status Available in: contrib Maintainers: @jamesmoessis Source: opentelemetry-collector-contrib

Supported Telemetry

Metrics

Overview

:information_source: Requires Docker API version 1.25+

Configuration

The following settings are optional:
  • endpoint (default = unix:///var/run/docker.sock (Linux) , default = npipe:////./pipe/docker_engine (Windows) ): Address to reach the desired Docker daemon.
  • collection_interval (default = 10s): The interval at which to gather container stats.
  • initial_delay (default = 1s): defines how long this receiver waits before starting.
  • container_labels_to_metric_labels (no default): A map of Docker container label names whose label values to use as the specified metric label key.
  • env_vars_to_metric_labels (no default): A map of Docker container environment variables whose values to use as the specified metric label key.
  • excluded_images (no default, all running containers monitored): A list of strings, regexes, or globs whose referent container image names will not be among the queried containers. !-prefixed negations are possible for all item types to signify that only unmatched container image names should be excluded.
    • Regexes must be placed between / characters: /my?egex/. Negations are to be outside the forward slashes: !/my?egex/ will exclude all containers whose name doesn’t match the compiled regex my?egex.
    • Globs are non-regex items (e.g. /items/) containing any of the following: *[]{}?. Negations are supported: !my*container will exclude all containers whose image name doesn’t match the blob my*container.
  • timeout (default = 5s): The request timeout for any docker daemon query.
  • api_version (default = auto-negotiate): The Docker client API version (must be 1.25+). When not specified, the client automatically negotiates the highest mutually supported API version with the Docker daemon. To pin a specific version, set it as a string, not a float (e.g. "1.44" instead of 1.44). Docker API versions.
  • metrics (defaults at ./documentation.md): Enables/disables individual metrics. See ./documentation.md for full detail.
Example:
The full list of settings exposed for this receiver are documented in config.go with detailed sample configurations in testdata/config.yaml.

Docker Socket Permissions

Requirements

This receiver requires access to the Docker daemon socket to query container statistics. The Docker socket requires specific permissions:
  • Linux (/var/run/docker.sock): Accessible by root user or members of the docker group
  • Windows (npipe:////./pipe/docker_engine): Requires appropriate named pipe permissions
Since version 0.40.0, official OpenTelemetry Collector images run as a non-root user for security. This creates a permission conflict when accessing the Docker socket.

Permission Solutions

Grant Docker Group Access

On Linux, grant the collector process access to the docker group by adding the host’s docker group ID as a supplementary group to the container process:
Note: The --group-add flag adds the host’s group ID as a supplementary group to the container process. This works because the mounted socket retains the host’s group ownership. If you have user namespaces enabled in Docker, additional configuration may be required.

Run as Root

If running as root is acceptable for your environment:
Note: Running as root is not recommended for production environments.

Alternative Approaches

For enhanced security, consider:
  • Using a Docker API proxy (e.g. docker-socket-proxy) that restricts access to only required endpoints
  • Running this receiver in an isolated collector instance with elevated privileges that only exports data (does not expose receiver ports like OTLP or Zipkin), forwarding metrics to your main collector via OTLP. This reduces the attack surface and RCE risk on the privileged container.
For more information, see issue #11791.

Deprecations

Transition to cpu utilization metric name aligned with OpenTelemetry specification

The Docker Stats receiver has been emitting the following cpu memory metric:
  • [container.cpu.percent] for the percentage of CPU used by the container,
This is in conflict with the OpenTelemetry specification, which defines [container.cpu.utilization] as the name for this metric. To align the emitted metric names with the OpenTelemetry specification, the following process will be followed to phase out the old metrics:
  • Between v0.79.0 and v0.86.0, the new metric is introduced and the old metric is marked as deprecated. Only the old metric are emitted by default.
  • In v0.88.0, the old metric is disabled and the new one enabled by default.
  • In v0.89.0 and up, the old metric is removed.
To change the enabled state for the specific metrics, use the standard configuration options that are available for all metrics. Here’s an example configuration to disable the old metrics and enable the new metrics:

Migrating from ScraperV1 to ScraperV2

Note: These changes are now in effect and ScraperV1 have been removed as of v0.71. There are some breaking changes from ScraperV1 to ScraperV2. The work done for these changes is tracked in #9794.

Metrics

Attributes

Resource Attributes

Configuration

Example Configuration


Last generated: 2026-08-24