Docker + Windows + Prometheus : How/Where to supply the configuration files
Was able to make it work in windows env.
For running prometheus with docker in the same network:
Check this: https://docs.docker.com/config/thirdparty/prometheus/
Steps:
List item
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
Hope this helps.Have created a sample working project: https://github.com/mayank1989gupta/GradleAutoDeployYou can find more details related to the same.
That tutorial from DO is outdated. Basically, tho related things were changed in Prometheus since v2.0:
- new CLI options format: double dash for long options, like
--config.file
- options
storage.local.*
(and some others) were removed
Correct command would be:
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
Change the command to:
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
You just need to make -config
to --config
by adding a -
before -config
.
It worked for me.