Pessoal, bom dia, para quem passar pelo mesmo problema que eu, com erro no container do Prometheus, Aula 02 Subindo a stack com API e Prometheus, segue o erro e a solução.
- Página do Prometheus não abre: http://localhost:9090/
- Verificado que o Container do Prometheus tá com status "Restarting (2) 52 seconds ago":
fernando@debian10x64:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
83e10d4ed708 prom/prometheus:latest "/bin/prometheus --c…" 11 minutes ago Restarting (2) 52 seconds ago prometheus-forum-api
ee9f972a9709 client-forum-api "/scripts/client.sh" 11 minutes ago Up 11 minutes client-forum-api
64fdc02e7306 nginx "/docker-entrypoint.…" 11 minutes ago Up 11 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp proxy-forum-api
2aa62dd5f35b app-forum-api "java -Xms128M -Xmx1…" 11 minutes ago Up 11 minutes (unhealthy) app-forum-api
05941ffc7974 mysql:5.7 "docker-entrypoint.s…" 11 minutes ago Up 11 minutes mysql-forum-api
2c025f59b117 redis "docker-entrypoint.s…" 11 minutes ago Up 11 minutes redis-forum-api
fernando@debian10x64:~$
Erros nos logs do container:
`
ts=2022-11-15T02:53:32.251Z caller=main.go:564 level=info vm_limits="(soft=unlimited, hard=unlimited)" ts=2022-11-15T02:53:32.251Z caller=query_logger.go:91 level=error component=activeQueryTracker msg="Error opening query log file" file=/prometheus/queries.active err="open /prometheus/queries.active: permission denied" panic: Unable to create mmap-ed active query log
goroutine 1 [running]: github.com/prometheus/prometheus/promql.NewActiveQueryTracker({0x7ffe26e49ef7, 0xb}, 0x14, {0x3b92b80, 0xc0009356d0}) /app/promql/query_logger.go:121 +0x3cd main.main() /app/cmd/prometheus/main.go:618 +0x6973
- SOLUÇÃO:
Adicionar o seguinte no Docker-compose, na parte do container do Prometheus:
user: "1000:1000"
- Exemplo:
docker-compose.yml
services:
prometheus-forum-api:
image: prom/prometheus:latest
container_name: prometheus-forum-api
restart: unless-stopped
user: "1000:1000"
`