I’m trying to build and run the image with a non-root user and keep getting the error: “unable to find user test: no matching entries in passwd file.”
Here’s what my Docker file looks like:
FROM openjdk:11-jre-slim RUN addgroup --system test RUN adduser --system testuser --ingroup test USER test:testuser COPY build/libs/abc-0.0.1.jar app.jar ENTRYPOINT ["java","-jar", "app.jar"]
I already tried searching for the error and looked at other places but none seems to work for me. Could someone help me out here? I know I can run it with the root user but I don’t want to or if there’s another Openjdk11 image that I could use to make it work then that’s also fine.
The issue is with the line
You are creating a usergroup called
test and a user called
testuser but in your
USER statement in the Dockerfile you specify
test:testuser, which is not the correct order. It must be like
See the Dockerfile reference here.