在 Docker Compose 中从 PromLens 连接到 Prometheus

问题描述 投票:0回答:1

我想运行 Prometheus 并将 PromLens 连接到它。

我编写了以下 Docker Compose 文件:

services:
  prometheus:
    image: prom/prometheus:v2.50.1
    ports:
      - 9090:9090

  promlens:
    image: prom/promlens:v0.3.0
    ports:
      - 8080:8080

我可以同时打开:

  • http://localhost:9090/ 用于普罗米修斯
  • PromLens 的 http://localhost:8080/

但是当我打开PromLens时,我无法通过http://prometheus:9090/连接到Prometheus

Error validating server health: Failed to fetch

如何连接到 Prometheus?

docker-compose prometheus promlens
1个回答
0
投票

我的错。我必须指定的地址不在 Docker 环境内,而是在我的真实环境中。所以连接 http://localhost:9090 正在工作。

我认为 PromLens 作为浏览器应用程序工作,并从浏览器连接,而不是从容器内部连接。

© www.soinside.com 2019 - 2024. All rights reserved.