docker运行prometheus报错:error loading config from \"prometheus.yml\": couldn't load configuration

目录

prometheus.yml路径

原命令

报错

 解决

完整命令


prometheus.yml路径

/root/katy/prometheus/prometheus.yml

原命令

// --log.level=debug: log以debug模式输出
// --storage.tsdb.retention.time=3d: 数据保留时间为3天
docker run -d -p 9090:9090 -v /root/katy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro prom/prometheus:latest --log.level=debug --storage.tsdb.retention.time=3d

报错

docker ps |grep prometheus根本没起起来。

从日志level可以看出我的log.level=dubug已经生效,并且还可以看到我设置的retention时间。

但在加载配置文件的时候就报错:

error loading config from \"prometheus.yml\": couldn't load configuration (--config.file=\"prometheus.yml\"): open prometheus.yml: no such file or directory

 解决

有大佬说-v是挂载目录,不能用文件,我操作了,效果一样的。

https://github.com/prometheus/prometheus/issues/5986

在命令后追加--config.file=/etc/prometheus/prometheus.yml,就解决了

完整命令

// --log.level=debug:日志以debug输出
// --storage.tsdb.retention.time=3d,数据保留3天
// --config.file=/etc/prometheus/prometheus.yml:这个其实是容器里面的默认路径,我也不知道为啥需要这个,反正我加了这个就解决了
docker run -d -p 9090:9090 -v /root/katy/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml --name prometheus  prom/prometheus:latest --log.level=debug --storage.tsdb.retention.time=3d --config.file=/etc/prometheus/prometheus.yml

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值