BuildKit silently gives files to root on missing --chown user
With Docker 29.9.1, buildx v0.38.0 and BuildKit v0.34.0, a COPY --chown=nosuchuser build exits 0 and leaves files owned by 0:0 with no warning. Numeric IDs of 2^31 or more also become root, and a missing group with a numeric user falls back to that user's group. Only --link and a FROM scratch stage without passwd fail.
- COPY --chown=nosuchuser built with exit 0, file owned by 0:0
- IDs of 2147483648 and above are treated as names and become root
- chown=1000:nosuchgroup produced 1000:1000 instead of an error
- Fix buildkit#7295 was closed unmerged on October 20
Read next
Software