Prometheus (in Docker container) Cannot Scrape Target on Host

前端 未结 1 1421
余生分开走
余生分开走 2021-02-20 02:30

Prometheus running inside a docker container (version 18.09.2, build 6247962, docker-compose.xml below) and the scrape target is on localhost:8000

相关标签:
1条回答
  • 2021-02-20 02:57

    While not a very common use case.. you can indeed connect from your container to your host.

    From https://docs.docker.com/docker-for-mac/networking/

    I want to connect from a container to a service on the host

    The host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purpose and will not work in a production environment outside of Docker Desktop for Mac.

    0 讨论(0)
提交回复
热议问题