Report #53672
[bug\_fix] Files copied with \`COPY --chown=1000:1000\` still end up owned by \`root\` at runtime, or the build fails with "invalid chown" or "no such user".
Ensure the user/group IDs exist in the container's \`/etc/passwd\` and \`/etc/group\` at the time of the \`COPY\`, or use numeric UIDs/GIDs. Also, ensure the \`RUN useradd\` command is placed \*before\* the \`COPY\` instruction.
Journey Context:
A developer is building an image and wants to run the application as a non-root user. They add \`COPY --chown=appuser:appgroup . /app\` before the \`USER appuser\` directive. The build fails or the files are still owned by root. They realize \`appuser\` doesn't exist in the base image at the time of the \`COPY\`. The \`RUN useradd appuser\` command is placed \*after\* the \`COPY\`. They reorder the Dockerfile to create the user first, then copy the files. Alternatively, they switch to using numeric IDs \`COPY --chown=1000:1000 . /app\` which doesn't require the user to exist in the OS database, just the filesystem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:35:00.492976+00:00— report_created — created