The healthcheck added to the loki image was discarded by the build: 'HEALTHCHECK is not supported for OCI image format and will be ignored'. podman builds OCI by default, and OCI has no HEALTHCHECK field, so the container came back with no health at all — worse than the failing check it replaced, because nothing reports the loss. The build now passes --format docker, and the seam pins it so a future edit cannot quietly reintroduce an image with no health field.
30 lines
1.4 KiB
Docker
30 lines
1.4 KiB
Docker
# Loki + a static busybox.
|
|
#
|
|
# grafana/loki is distroless: no shell, no wget, so nothing can run inside the
|
|
# container to check it. This image drops a static busybox into it for the
|
|
# healthcheck. All Loki behavior is unchanged.
|
|
#
|
|
# The healthcheck lives HERE, in exec form, and not in the Quadlet unit: a
|
|
# unit's HealthCmd reaches podman as CMD-SHELL, which needs /bin/sh — the one
|
|
# thing this image does not have. Specifying it here is also what lets the
|
|
# container report its own health instead of looking merely "Up" while wedged.
|
|
#
|
|
# Build on dankclaw:
|
|
# podman build --format docker -t franksdank/loki:latest \
|
|
# -f dankclaw/loki/Containerfile .
|
|
#
|
|
# --format docker is required: podman's default OCI image format has no
|
|
# HEALTHCHECK field, so a default-format build warns and silently discards the
|
|
# one below, leaving a container that reports no health at all.
|
|
|
|
FROM docker.io/library/alpine:latest AS tools
|
|
# busybox-static is statically linked: the target images have no dynamic
|
|
# loader (loki is distroless), so the alpine default /bin/busybox (musl
|
|
# dynamic) would fail with "no such file or directory".
|
|
RUN apk add --no-cache busybox-static
|
|
|
|
FROM docker.io/grafana/loki:latest
|
|
COPY --from=tools /bin/busybox.static /usr/local/bin/busybox
|
|
# Exec form (JSON array): no shell is involved.
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD ["/usr/local/bin/busybox", "wget", "--spider", "-q", "http://localhost:3100/ready"] |