From 1054fdcc56e448f3aec2f14589a0f3ef78d3694e Mon Sep 17 00:00:00 2001 From: Adrien Gentil Date: Tue, 2 Jul 2024 18:35:30 +0200 Subject: [PATCH] WIP: NO-ISSUE: Create data dir after changing UID/GID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the image service fails to start using podman with a permission error: ``` {“file”:“/go/src/github.com/openshift/origin/main.go:132",“func”:“main.main.func1",“level”:“fatal”,“msg”:“Failed to populate image store: failed to download https://mirror.openshift.com/pub/openshift-v4/x86_64/dependencies/rhcos/4.14/4.14.15/rhcos-4.14.15-x86_64-live.x86_64.iso: unable to create a temp file for /data/rhcos-full-iso-4.14-414.92.202402130420-0-x86_64.iso: open /data/.rhcos-full-iso-4.14-414.92.202402130420-0-x86_64.iso271460763: permission denied\n”,“time”:“2024-07-02T15:46:45Z”} ``` This change ensures that `/data` directory is writable for the UID/GID that will be used to execute the image service executable. --- Dockerfile.image-service | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.image-service b/Dockerfile.image-service index f444b32e..63be228d 100644 --- a/Dockerfile.image-service +++ b/Dockerfile.image-service @@ -37,12 +37,14 @@ LABEL maintainer "Red Hat" COPY --from=licenses /tmp/licenses /licenses ARG DATA_DIR=/data -RUN mkdir $DATA_DIR && chmod 775 $DATA_DIR +ARG UID=1001 +ARG GID=1001 +RUN mkdir $DATA_DIR && chmod 775 $DATA_DIR && chown $UID:$GID /data VOLUME $DATA_DIR ENV DATA_DIR=$DATA_DIR COPY --from=builder /assisted-image-service /assisted-image-service -USER 1001:1001 +USER $UID:$GID CMD ["/assisted-image-service"]