我正在尝试传递我自己的prometheus.yml文件。我对docker很陌生,我找到的例子都在Linux系统上,我在windows上。如何/在哪里提供我自己的yaml文件的最佳方式?下面的命令无法启动码头容器。
docker run -d -p 9090:9090 -v c:\Docker\prometheus.yml:/etc/prometheus/prometheus.yml --name=prometheus prom/prometheus -config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000当我尝试运行这个命令时,Docker会提示我,如果我想要共享我的C:驱动器,但仍然没有成功地让容器运行。
下面是码头工人的日志上说的话:
Error parsing commandline arguments: unknown short flag '-c'
prometheus: error: unknown short flag '-c'因此,我删除了数字海洋在其示例中使用的最后几个参数,容器现在运行。
-storage.local.path=/prometheus -storage.local.memory-chunks=10000
所以现在我的问题是,我是否需要指定这些配置,如果需要,语法是什么?
发布于 2019-03-01 17:25:35
能让它在windows env上工作。
用于在同一个网络中运行带有码头的prometheus:
检查这个:https://docs.docker.com/config/thirdparty/prometheus/
步骤:
- Click the Docker icon in the toolbar, select Preferences, then select Daemon. Click Advanced. "metrics-addr" : "127.0.0.1:9323", "experimental" : true
- restart docker
- create C:\tmp\prometheus.yml [As per your choice]
- under targets --> targets: ['docker.for.win.localhost:8001']
- docker run --name container-name --network=network-name --mount type=bind,source=C:/tmp/prometheus.yml,destination=/etc/prometheus/prometheus.yml --publish published=9090,target=9090,protocol=tcp prom/prometheus
- URL: localhost:9090
希望这能有所帮助。创建了一个示例工作项目:https://github.com/mayank1989gupta/GradleAutoDeploy,您可以找到与该项目相关的更多细节。
发布于 2019-11-26 13:18:01
DO的那个教程已经过时了。基本上,从2.0版开始,Prometheus中的相关内容是变了:
--config.filestorage.local.* (和其他一些选项)被删除正确的命令是:
docker run -d -p 9090:9090 -v c:\Docker\prometheus.yml:/etc/prometheus/prometheus.yml --name=prometheus prom/prometheus --config.file=/etc/prometheus/prometheus.yml
发布于 2020-05-18 08:26:13
将命令更改为:
docker run -d -p 9090:9090 -v c:\Docker\prometheus.yml:/etc/prometheus/prometheus.yml --name=prometheus prom/prometheus --config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000
您只需要将-config添加到--config,在-config之前添加一个-即可。
对我起作用了。
https://stackoverflow.com/questions/53437764
复制相似问题