Dockerstats Receiver
contrib
Maintainers: @jamesmoessis
Source: opentelemetry-collector-contrib
Supported Telemetry
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 regexmy?egex. - Globs are non-regex items (e.g.
/items/) containing any of the following:*[]{}?. Negations are supported:!my*containerwill exclude all containers whose image name doesn’t match the blobmy*container.
- Regexes must be placed between
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 of1.44). Docker API versions.metrics(defaults at ./documentation.md): Enables/disables individual metrics. See ./documentation.md for full detail.
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 byrootuser or members of thedockergroup - Windows (
npipe:////./pipe/docker_engine): Requires appropriate named pipe permissions
Permission Solutions
Grant Docker Group Access
On Linux, grant the collector process access to thedocker group by adding the host’s docker group ID as a supplementary group to the container process:
--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: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.
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,
- Between
v0.79.0andv0.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.0and up, the old metric is removed.
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-10-05