环境:
win10
docker-version:4.3.0 [搭建win10-k8s时的k8s-for-docker-desktop-master 的最新版本为1.22.4]
其中遇见的坑:
1>
本地prometheus.yml文件指向docker内部的prometheus.yml命令:
docker run --mount type=bind,source=d:/prometheus/conf/prometheus.yml,destination=/etc/prometheus/prometheus.yml --publish published=9090,target=9090,protocol=tcp prom/prometheus
或者
docker run -p 9090:9090 -v /d/prometheus/conf/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
都行,其中 /d/prometheus/conf/prometheus.yml代表d:/prometheus/conf/prometheus.yml
2>
parsing YAML file /etc/prometheus/prometheus.yml: yaml: line 24: could not find expected ':'
-源自输入命令:
docker run --mount type=bind,source=d:/prometheus/conf/prometheus.yml,destination=/etc/prometheus/prometheus.yml --publish published=9090,target=9090,protocol=tcp prom/prometheus
-原因:
这个报错原因不是在/etc/prometheus/prometheus.yml上,而是在本地的prometheus.yml上,我后面发现是我多加了一个":"号;