windows - Docker + Windows + Prometheus:如何/在哪里提供配置文件
问题描述
我正在尝试传入我自己的 prometheus.yml 文件。我是 docker 新手,我找到的示例都在 Linux 系统上,而且我在 Windows 上。如何/在哪里提供我自己的 yaml 文件的最佳方式?以下命令无法启动 docker 容器。
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'
所以我删除了Digital Ocean在他们的例子中的最后几个参数,容器现在运行了。
-storage.local.path=/prometheus -storage.local.memory-chunks=10000
所以现在我的问题是,我是否需要指定这些配置,如果需要,语法是什么?
解决方案
能够使其在 Windows 环境中工作。
在同一网络中使用 docker 运行 prometheus:
检查这个:https ://docs.docker.com/config/thirdparty/prometheus/
脚步:
项目清单
单击工具栏中的 Docker 图标,选择 Preferences,然后选择 Daemon。单击高级。“metrics-addr”:“127.0.0.1:9323”,“实验”:true
重启泊坞窗
- 创建 C:\tmp\prometheus.yml [根据您的选择]
- 在目标 --> 目标下:['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,目标=9090,协议=tcp 舞会/普罗米修斯
- 网址:本地主机:9090
希望这可以帮助。创建了一个示例工作项目:https ://github.com/mayank1989gupta/GradleAutoDeploy 您可以找到与此相关的更多详细信息。
推荐阅读
- excel - 在 Excel 中,在图表标题中使用字符串连接公式时出现问题
- bash - 将多个文件单独合并为一个文件
- codeigniter - 强化扫描 - 可能的变量覆盖:全局范围
- mocking - 我正在尝试使用 mockaroo curl 请求生成一个 csv 文件,但我没有在响应中获得完整的 1000 条记录。可能是什么原因?
- c# - 从 JSON 字符串中获取键值对
- android - java - 如何将java中的方法引用(::)替换为普通的构造函数调用?
- python - scrapy-crawlera 是否处理 429 状态码?
- python - Python time.sleep() 问题?
- yii - 在 Yii2 表单中添加仅字母验证
- angular - Bootstrap 4.2.1 汉堡包不可点击