From af4feb1a994c739a22b590c88c3fab0acc3fc1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Moen?= Date: Thu, 20 Nov 2025 21:25:05 +0100 Subject: [PATCH] fix(docker): set WORKDIR to root in loki Dockerfiles The distroless static image has workdir set to /home/nonroot, owned by the user nonroot with uid of 65532 and permission of 700. Since the user is changed to loki with uid 1001, this can cause the startup of container to fail, as there is no permission to enter the workdir. --- cmd/loki/Dockerfile | 1 + cmd/loki/Dockerfile.cross | 1 + 2 files changed, 2 insertions(+) diff --git a/cmd/loki/Dockerfile b/cmd/loki/Dockerfile index 6fefcd7a2e095..66465354cb29f 100644 --- a/cmd/loki/Dockerfile +++ b/cmd/loki/Dockerfile @@ -26,6 +26,7 @@ COPY --from=filesystem /etc/passwd /etc/passwd COPY --from=filesystem /etc/group /etc/group USER 10001 +WORKDIR / EXPOSE 3100 ENTRYPOINT [ "/usr/bin/loki" ] CMD ["-config.file=/etc/loki/local-config.yaml"] diff --git a/cmd/loki/Dockerfile.cross b/cmd/loki/Dockerfile.cross index dd0a1c2323b33..2a4cb929a46c0 100644 --- a/cmd/loki/Dockerfile.cross +++ b/cmd/loki/Dockerfile.cross @@ -28,6 +28,7 @@ COPY --from=filesystem /etc/passwd /etc/passwd COPY --from=filesystem /etc/group /etc/group USER 10001 +WORKDIR / EXPOSE 3100 ENTRYPOINT [ "/usr/bin/loki" ] CMD ["-config.file=/etc/loki/local-config.yaml"]