title: how to make the node-exporter and cadvisor available to prometheus container only?
body: <p>I have successfully setup Prometheus service in a docker container.Also I am running the services like node-exporter and cadvisor on different other ports in the same hosts.</p>
  
  <p>All  the services are being run using the docker-compose.
  Here is the sample </p>
  
  <pre><code>version: '2'
  
  
  volumes:
      grafana_data: {}
  
  services:
  
      prometheus:
          image: prom/prometheus
          privileged: true
          volumes:
              - ./prometheus.yml:/etc/prometheus/prometheus.yml
              - ./alertmanager/alert.rules:/alertmanager/alert.rules
          command:
              - '--config.file=/etc/prometheus/prometheus.yml'
          ports:
              - '9090:9090'
  
      node-exporter:
          image: prom/node-exporter
          ports:
              - '9100:9100'
      cadvisor:
          image: google/cadvisor:latest 
          privileged: true
          volumes:
              - /:/rootfs:ro
              - /var/run:/var/run:rw
              - /var/lib/docker/:/var/lib/docker:ro
              - /dev/disk/:/dev/disk:ro
              - /cgroup:/sys/fs/cgroup:ro
          ports:
              - '8080:8080'
  </code></pre>
  
  <blockquote>
    <p>How to make the <strong>cadvisor</strong> service not accessible to public as for
    now everyone can access the cadvisor and node-exporter visiting the
    host url with ports it is being assigned. But as the prometheus
    depends on it only prometheus should be able to access it.</p>
  </blockquote>