3

I try to run a opentelemetry docker image with the config yaml file as an argument :

docker run -v "./otel-collector-config.yaml":/otel-collector-config.yaml -p 4317:4317 otel/opentelemetry-collector:latest --config=otel-collector-config.yaml

I keep getting this error message :

2021-10-01T08:21:05.384Z        info    service/collector.go:303        Starting otelcol...     {"Version": "0.35.0", "NumCPU": 12}
2021-10-01T08:21:05.384Z        info    service/collector.go:242        Loading configuration...
Error: cannot load configuration's parser: error loading config file "/etc/otel-collector-config.yaml": unable to read the file /etc/otel-collector-config.yaml: read /etc/otel-collector-config.yaml: is a directory
2021/10/01 08:21:05 application run finished with error: cannot load configuration's parser: error loading config file "/etc/otel-collector-config.yaml": unable to read the file /etc/otel-collector-config.yaml: read /etc/otel-collector-config.yaml: is a directory

Seems like the app cannot read the file passed in volume, as it appears to be a directory, rather than a file.

Does anyone have a clue how I could get this file to be mounted as a file, or guide me toward what I am doing wrong ?

I have tried all possible combination of with/without " around the files name or also playing with = to var assignement - nothing worked so far.

Please note that I am working on Windows, in case this would a operating system's related issue.

balias
  • 499
  • 1
  • 4
  • 17
Will
  • 1,792
  • 2
  • 23
  • 44

1 Answers1

1

I finally found an answer, thanks to this post

You need to specify the full path of the file you want to mount. If not, because docker will not find the fill, it will create an empty directory based on the name of the file !

Will
  • 1,792
  • 2
  • 23
  • 44