1

...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"]
transient_loop
  • 459
  • 1
  • 4
  • 11

1 Answers1

0

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.

transient_loop
  • 459
  • 1
  • 4
  • 11