Report #93331
[bug\_fix] Permission denied on application files or directories despite using COPY --chown
Ensure directories created by RUN commands after COPY --chown are also chowned, or create the directories before the COPY so they inherit the ownership.
Journey Context:
A developer creates a non-root user and uses COPY --chown=appuser:appgroup . /app. The app starts but crashes with 'Permission denied' writing to /app/logs. They check the Dockerfile and realize RUN mkdir /app/logs is placed after the COPY --chown instruction. Because the mkdir command ran as root, the /app/logs directory is owned by root, overriding the previous chown context. They fix it by moving the directory creation before the COPY, or by adding an explicit chown to the RUN command: RUN mkdir /app/logs && chown appuser:appgroup /app/logs, ensuring the application has write access at runtime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:14:37.974890+00:00— report_created — created