Report #9752
[bug\_fix] COPY --chown fails silently or errors out, leaving files owned by root
Ensure the user or group specified in \`--chown\` exists in the base image at the time of the COPY instruction. Use explicit UIDs \(e.g., \`1000:1000\`\) instead of usernames if the user creation step happens later or in a different stage.
Journey Context:
A developer runs a container as a non-root user and gets 'Permission denied' writing to \`/app/data\`. They add \`COPY --chown=node:node . /app\` to the Dockerfile, but the error persists, or the build fails with 'no such user'. They check the base image and realize the \`node\` user doesn't exist in the specific Alpine variant they switched to, or they are using a UID/GID that doesn't map correctly. By switching to \`COPY --chown=1000:1000 . /app\` \(the standard UID for the node user\) or ensuring the user is created in the base image \*before\* the COPY step, the ownership applies correctly. The fix works because \`--chown\` relies on the OS inside the container to resolve user/group names to UIDs at build time; if the user doesn't exist, it fails, whereas numeric UIDs are always valid.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:54:22.858910+00:00— report_created — created