无法安装 docker 卷来运行 opentelemetry 映像

Wil*_*ill 6 volume docker open-telemetry

我尝试使用配置 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
Run Code Online (Sandbox Code Playgroud)

我不断收到此错误消息:

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
Run Code Online (Sandbox Code Playgroud)

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

有谁知道如何将此文件作为文件安装,或者引导我发现我做错了什么?

我已经尝试了所有可能的带/不"带文件名的组合,或者也尝试了=var 赋值 - 到目前为止没有任何效果。

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

Wil*_*ill 2

终于找到答案了,感谢这篇文章

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