Can I change the username of the node user inside the Dockerfile to "dev"? Will that break things? #5125
Description
Node.js Version
v24.12.0
NPM Version
11.7.0
Operating System
Linux api 6.14.0-37-generic #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 20 10:25:38 UTC 2 x86_64 GNU/Linux
Subsystem
Other
Description
I want to have a user inside the Docker container with UID 1000 and GID 1000.
I'm already using this Dockerfile:
https://github.com/nodejs/docker-node/blob/main/24/trixie-slim/Dockerfile
I see that the node user is created with that UID and GID.
What if I rename that use to dev? Does that break anything?
Minimal Reproduction
No response
Output
No response
Before You Submit
- I have looked for issues that already exist before submitting this
- My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask
https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user in #5125 (comment) already provided the answer:
Note that the node user is neither a build-time nor a run-time dependency and it can be removed or altered, as long as the functionality of the application you want to add to the container does not depend on it.
Activity
avivkeller commentedon Dec 29, 2025
@nodejs/docker
nschonni commentedon Dec 29, 2025
https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user talks about changing the UID
Nefcanto commentedon Dec 30, 2025
@nschonni I read that part. I just want to change the name of the user. This is my
coreimage:It builds. No problem. But then I have this
panelimage that uses mycoreimage:It fails when I add
RUN usermod -d /home/dev -l dev nodeline. This is the permission error:When I run it as
nodeuser, both images are built. But when I change the username todevit seems that the permissions are broken. Do you have any idea why?LegendCo commentedon Jun 17, 2026
In general, renaming the node user to dev will not inherently break Node.js itself. Linux processes care about the numeric UID/GID much more than the username. If the user remains UID 1000 and GID 1000, most software will continue to work exactly the same way.
If you're building on top of the official image, it's often simpler to leave the node user as-is and just use:
USER nodeMikeMcC399 commentedon Aug 10, 2026
https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user in #5125 (comment) already provided the answer: