Skip to content

Respect the environment variable DOCKER_HOST in resolving the endpoint #35779

Open
@michaelsafyan

Description

@michaelsafyan

Component(s)

receiver/dockerstats

Is your feature request related to a problem? Please describe.

The dockerstatsreceiver by default uses unix:///var/run/docker.sock. Although the configuration supports overridding the endpoint with something other than the default, it should not be necessary to specify the endpoint explicitly when the environment variable DOCKER_HOST has been defined, pointing to the correct location.

Note that the Docker documentation defines DOCKER_HOST as the "Daemon socket to connect to":

There may be certain environments where the environment variable DOCKER_HOST has been set correctly to a non-standard endpoint and where it is difficult to modify the dockerstatsreceiver config. For those situations, respecting DOCKER_HOST for the default endpoint would be ideal.

Describe the solution you'd like

The docker endpoint should be resolved in the following order:

  1. The value of endpoint if it is set in the YAML config for the receiver.
  2. The value of the environment variable DOCKER_HOST if it is set.
  3. The fallback constant value of unix:///var/run/docker.sock

Describe alternatives you've considered

Run a script to modify the endpoint in the YAML from the ${DOCKER_HOST} value.

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions