Go Prometheus guide: healthcheck uses wrong port and lacks curl
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, go
- Ambito
- devops, documentation
Direzione di ricerca
Inizia da compose.yaml, dall'esempio Compose in README.md, da main.go e dal Dockerfile dello stage finale nell'esempio go-prometheus-monitoring. Confronta l'healthcheck con il listener :8000 dell'API e con gli strumenti installati nell'immagine Alpine finale. Il lavoro è completato quando gli healthcheck documentati e quelli dell'esempio usano la porta corretta, il relativo comando è disponibile e segnalano che il container è integro dopo una nuova build.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
Information is incorrect
Description
The Go + Prometheus + Grafana guide's sample starts the API successfully, but the container remains unhealthy.
I reproduced this using Docker Desktop on Windows 11.
The API itself was running, and Prometheus could access /metrics. The API logs showed successful HTTP 200 responses. However, docker compose ps reported the API container as unhealthy.
Inspecting the health status showed:
exec: "curl": executable file not found in $PATH
There are two related inconsistencies in the current sample:
compose.yamland the Compose example inREADME.mdcheckhttp://localhost:8080/health, whilemain.golistens on:8000and the Dockerfile exposes port8000.- The healthcheck invokes
curl, but the finalalpine:3.17image does not install it.
Relevant current configuration:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
router.Run(":8000")
FROM alpine:3.17 AS final
EXPOSE 8000
After changing the healthcheck port to 8000, installing curl, and rebuilding the API image, the container changed from unhealthy to healthy.
Sample repository: https://github.com/dockersamples/go-prometheus-monitoring
Location
https://docs.docker.com/guides/go-prometheus-monitoring/
Suggestion
Update the healthcheck in both compose.yaml and the README example to use port 8000:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
Also make the healthcheck executable available in the final image, for example:
RUN apk add --no-cache curl
Alternatively, use a healthcheck command that is already available in the final image.
- Lingua principale
- Markdown
- Stelle
- 4.7k
- Fork
- 8.5k
- Merge medio
- 2g 18h
- PR unite (30g)
- 108
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di docker/docs
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
area/dhi status/triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
-
status/triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Issue simili
-
kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
kubernetes-sigs/prow#953 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
automated-analysis bug memory-safety
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
area/entangle bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
kind/bug Ubuntu 24
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kubernetes-sigs/kubespray#13532 ·