Score:0

Still can't connect from my grafana docker container to prometheus

ru flag

...after having followed a bunch of tutorials, e.g.

https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66

I started the grafana container with:

%box docker run -d -p 3000:3000 --add-host=host.docker.internal:host-gateway --name grafana grafana/grafana-oss

But when I try to reach the prometheus instance from the grafana container it doesn't work and times out.

box% docker exec -it grafana /bin/bash         
bash-5.1$ wget http://host.docker.internal:9090
Connecting to host.docker.internal:9090 (172.17.0.1:9090)

Host is arch linux. What am I doing wrong?

EDIT: Maybe I have to configure prometheus differently? I just have

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "server"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["<HOST_IP:8088"]
Score:0
ru flag

Holy @#$%^

The solution is from another totally unexpected angle and I found it here:

https://www.cloudsavvyit.com/6940/how-to-access-ports-on-the-host-from-a-docker-container/

Looks like to ufw a request coming from a docker container is handled like a request coming from outside...which I did not at all anticipate.

Adding a rule for the docker container's range as in the post did it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.