3 ms·
I think you're not the only one that mentioned this omission, I'll throw in since it seems to be pretty poorly highlighted and has some surprising failure modes
by yebyen 7y ago
I think you're not the only one that mentioned this omission, I'll throw in since it seems to be pretty poorly highlighted and has some surprising failure modes:
When you use the USER directive to set up a working user in Dockerfile, be explicit about UID and use the numeric UID.
What works 99% of the time is to use alpha username in the "USER" directive. You can get some surprising artifacts if the container runtime hits this rare bug[1]. There are likely several other great ways this can go wrong, as well.
Somewhere deep in the manual, it is suggested that you should only use a numeric UID, even though USER accepts an alphanumeric username most of the time, but if you look at container images built by OpenShift and other pro docker-ers, you will see they always do this with a numeric UID.
[1]: https://forums.docker.com/t/unable-to-find-user-root-no-matching-entries-in-passwd-file/26545 https://forums.docker.com/t/unable-to-find-user-root-no-matc...