docker prometheus无法访问docker kafka_exporter

时间:2018-08-29 08:39:52

标签: docker docker-compose dockerfile prometheus

version: '3.4'
services:
  kafka_exporter:
    image: danielqsj/kafka-exporter
    command: --kafka.server=xx.xx.xx.xx:9092 --kafka.server=xx.xx.xx.xx:9092
    ports:
      - 9308:9308
    links:
      - prometheus
  prometheus:
    image: prom/prometheus
    ports:
    - 9090:9090
    volumes:
    - ./mount/prometheus:/etc/prometheus
    command: --config.file=/etc/prometheus/prometheus.yml

以上是我的docker-compose.yml文件。 我可以旋转两个图像。

但是,我无法从localhost:9308(prometheus)访问localhost:9090 kafka_Exporter

我需要链接/网络图像吗?

1 个答案:

答案 0 :(得分:1)

应为container_name:port

kafka_exporter:9308