【问题标题】:Can't mount docker volume to run opentelemetry image无法挂载 docker 卷来运行 opentelemetry 映像
【发布时间】:2021-11-22 22:02:35
【问题描述】:

我尝试使用配置 yaml 文件作为参数运行 opentelemetry docker 映像:

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

我不断收到此错误消息:

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

似乎该应用无法读取卷中传递的文件,因为它似乎是一个目录,而不是一个文件。

有没有人知道如何将这个文件作为文件挂载,或者指导我做错了什么?

我已经尝试了所有可能的文件名周围有/没有" 的组合,或者也尝试使用= 来分配变量 - 到目前为止没有任何效果。

请注意我正在处理Windows,以防这会与操作系统相关的问题。

【问题讨论】:

    标签: docker volume open-telemetry


    【解决方案1】:

    终于找到答案了,感谢post

    您需要指定要挂载的文件的完整路径。 如果不是,因为docker找不到填充,它会根据文件名创建一个空目录!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-01
      • 2021-06-25
      • 2014-12-08
      • 2020-07-05
      • 2017-09-19
      • 2018-05-31
      • 1970-01-01
      相关资源
      最近更新 更多