google-cloud-platformgoogle-cloud-runjobs

Getting random "User not found in file /etc/passwd" error on Cloud Run Job


I'm getting the follow random error, in less than 5% of my job executions, with the same container image:

Application failed to start: resolveUserIdentity("1001"): User not found in file /etc/passwd

enter image description here

My dockerfile:

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7

RUN microdnf install freetype fontconfig \
    && microdnf clean all
WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
COPY --chown=1001:root target/*.properties target/*.so /work/
COPY --chown=1001:root target/*-runner /work/application


EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

Any ideas?


Solution

  • I solved my case editing user 1001 to user 0 in all references in Dockerfile, following a similar fix to an error at GCP Troubleshoot:

    https://cloud.google.com/run/docs/troubleshooting?hl=en#error_user_root_is_not_found_in_etcpasswd

    FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
    
    RUN microdnf install freetype fontconfig \
        && microdnf clean all
    WORKDIR /work/
    RUN chown 0 /work \
        && chmod "g+rwX" /work \
        && chown 0:root /work
    COPY --chown=0:root target/*.properties target/*.so /work/
    COPY --chown=0:root target/*-runner /work/application
    
    
    EXPOSE 8080
    USER 0
    
    CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]