Docker non root user cant write to anonymous volume

22 Views Asked by At

I have a Dockerfile with an anonymous volume like this:

...
RUN adduser -D nonrootuser
RUN chown nonrootuser /app/log

USER nonrootuser
VOLUME /app/log

WORKDIR /app
COPY --from=build a/app.jar app.jar

EXPOSE 8080
ENTRYPOINT ["java","-jar","/app/app.jar"]

When my app starts it can't write to /app/log. How should I solve this? I want to have an anonymous volume and not a named one.

0

There are 0 best solutions below