'Get http://docker.for.win.localhost:9098/actuator no such host

I have a prometheus up on container in windows OS .

I wont to scrape my spring boot app which is up on simple localhost ( not dockerized) .

this is my prometheus.yml :

global: scrape_interval: 15s

alerting: alertmanagers:

  • static_configs:
    • targets:
      • localhost:9093 scheme: http timeout: 10s

rule_files:

  • "/alertmanager/alert.rules/alerts.rules.yml"

scrape_configs:

  • job_name: 'mySpringBootApp'
    metrics_path: '/actuator' static_configs:
    • targets: ['docker.for.win.localhost:9098']

I got this error on promethus target :

enter image description here

when i change the target in promethus.yml from ['docker.for.win.localhost:9098'] to ['localhost:9098'] i got the error : Get http://localhost:9098/actuator: dial tcp 127.0.0.1:9098: connect: connection refused

when i change the target to ['host.docker.internal:9098'] i got this error : "INVALID" is not a valid start token

can anyone please help ? How to configure prometheus on docker with simple app in localhost .

Please not if this can help my app is spriing boot app with spring security configured .

Thank you in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source