fix(docker-agent): let the host lower the Docker API version - #3286
Open
FreZZZeR wants to merge 1 commit into
Open
fix(docker-agent): let the host lower the Docker API version#3286FreZZZeR wants to merge 1 commit into
FreZZZeR wants to merge 1 commit into
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
The docker_stats receiver's api_version is pinned to 1.44 in the baked config, and
a daemon refuses a client newer than its own maximum. On Docker Engine 20.10, whose
API stops at 1.41, the receiver fails to start, takes the collector down with it and
the container restart-loops:
Error: cannot start pipelines: failed to start "docker_stats" receiver:
Error response from daemon: client version 1.44 is too new.
Maximum supported API version is 1.41
There was no way out without replacing the whole config, since the value was a
literal and the config lives inside the image. It now comes from DOCKER_API_VERSION,
which the image defaults to 1.44, so the pin that fixed the too-old default is kept
while a host with an older daemon can pass its own maximum. Plain ${env:...} rather
than a default-valued expansion, so this does not depend on the confmap version.
Documented in the agent README and the docs page, both with the error text people
will search for. Only the English docs page is updated; the other locales still
carry the old table.
Verified on Engine 20.10.17 (API 1.41): with DOCKER_API_VERSION=1.41 the receiver
starts and container.* metrics and container logs flow.
FreZZZeR
force-pushed
the
fix/docker-agent-api-version
branch
from
August 23, 2026 14:06
e218ce3 to
bc8762c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DockerAgent's collector config pins thedocker_statsreceiver toapi_version: "1.44". A Docker daemon rejects a client newer than its own maximum, so on any host running an older Engine the receiver fails to start — and because a failed receiver aborts pipeline startup, the whole collector exits and the container restart-loops:Reproduced on Docker Engine 20.10.17 (
API 1.41,min 1.12) — the agent never collected anything on that host.There was no clean way out. The value is a literal, and the config lives inside the image at
/etc/otelcol-contrib/config.yaml, so the only workarounds are to replace the vendor's config wholesale or to layer a second--configover it — both of which require knowing an internal path of the image.Fix
api_versionnow comes fromDOCKER_API_VERSION, which the image defaults to1.44. The pin that fixed the other direction stays in place (the receiver's own default1.25is rejected by modern daemons — the original comment explains this), while a host with an older daemon can pass its own maximum:The setting keeps working after the daemon is upgraded, since newer daemons still serve older API versions, so operators can drop it on their own schedule instead of urgently.
Why
${env:DOCKER_API_VERSION}and not${env:DOCKER_API_VERSION:-1.44}Default-valued expansion depends on the confmap version, and nothing else in this repo relies on it. Declaring the default as
ENVin the Dockerfile — the same pattern already used forDOCKER_HOST_NAME— works on any collector version and makes the default visible indocker inspect.Changes
DockerAgent/Dockerfile.tpl—ENV DOCKER_API_VERSION=1.44DockerAgent/otel-collector-config.yaml—api_version: "${env:DOCKER_API_VERSION}"DockerAgent/docker-compose.yml— passesDOCKER_API_VERSIONthrough, defaulting to1.44DockerAgent/README.md,docs/.../en/telemetry/docker-host.md— env-var row plus a troubleshooting entry that quotes the error text people will search forBehaviour is unchanged for anyone who does not set the variable.
Verification
On the affected host (Engine 20.10.17) with
DOCKER_API_VERSION=1.41:container.*metrics arrive on the 30s interval (container.memory.percent,container.pids.count,container.uptime,container.restarts);filelogreceiver.With the variable unset the image behaves exactly as before (
1.44).Notes
Only the English docs page is updated; the other locale copies of
telemetry/docker-host.mdstill carry the old environment-variable table. Happy to extend it if you would rather keep them in step.