Responsive Ad Area

Share This Post

test

docker container in host network and in a customer network

I had node-exporter and prometheus running in separate docker containers, but node-exporter was showing me strange data. Thus I decided to run node-exporter directly on the host, but because my dockers are in a separate network, I now struggle to connect prometheus to the node-exporter:9090

my docker-compose is

version: '2'

  prometheus:
    expose:
      - 9090

# Extra-network is necessary to have a dedicated IP for Logstash to forwards log to.
networks:
  default:
    external:
      name: myseparatenetwork

What I need is the host IP, for prometheus config to connect to node-exporter, but I cannot use localhost, because within the prometheus docker, that is not the actual host.

I tried

network_mode: "host"
networks:
  - myseparatenetwork

and

networks
  - myseparatenetwork
  - host

neither one works.

I also tried route and ip as in this article
From inside of a Docker container, how do I connect to the localhost of the machine? the accepted answer under
docker run –network=”bridge” (default)

but my addresses for gateway and destination are the same.

I believe what I need is currently not possible, given some articles I stumbled upon, but any new insights would be highly appreciated


docker container in host network and in a customer network
docker container in host network and in a customer network
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar