docker / docs

Source repo for Docker's Documentation
https://docs.docker.com
Apache License 2.0
4.19k stars 7.34k forks source link

Java language guide Dockerfile issue on final stage #21498

Open rogeriofrsouza opened 1 day ago

rogeriofrsouza commented 1 day ago

Is this a docs issue?

Type of issue

Information is incorrect

Description

I have a Spring Boot REST API project and I followed the Java language specific guide instructions to containerize it in the right way.

However, the build stage presented in the Dockerfile makes my app raise an exception because it has no permission to create a file. This occurs because I use Logback FileAppender feature for logging.

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "/nonexistent" \
    --shell "/sbin/nologin" \
    --no-create-home \
    --uid "${UID}" \
    appuser
USER appuser

Image

Location

https://docs.docker.com/guides/java/containerize/

Suggestion

I know that logging to a file is not a standard for every Spring Boot application, and maybe, I should not do it. However, I wonder if the Docker build should be compatible with this because some projects may require some kind of access to the file system.

dvdksn commented 6 hours ago

@ajeetraina @falconcr do you think it might be worth having a section about logging in this guide?