nodejs / docker-node

Official Docker Image for Node.js :whale: :turtle: :rocket:
https://hub.docker.com/_/node/
MIT License
8.13k stars 1.95k forks source link

Nodejs container version node:16.14.2-slim suddenly failed to start suggestion fix "chmod 1000:0 /root/.npm" #2017

Open muthu86 opened 5 months ago

muthu86 commented 5 months ago

Nodejs container image version 16.14.2-slim deployed in AWS Fargate failed to start suddenly with loading the webpack and suggesting to add "chmod 1000:0 /root/.npm/". Worked after adding the RUN chmod 1000:0 /root/.npm/ in Dockerfile. However we are not sure what would have made this behaviour to suddenly failed when the same Dockerfile without "chmod 1000:0 /root/.npm/" Worked before. Understand that there is no support for 16.14.2. But, Just wanted to understand the root cause of this so it doesnt occur again.

Environment- Production

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce

Additional Information

leqwasd commented 5 months ago

I have had the same issue, a couple of months ago. The most awkward thing - this "chmod 1000:0" is the user, that is used by the image (e.g. user in docker-compose.yml). But to add the "RUN chmod ..." - you have to know, which user to put here. So I have the dilemma - I build an image, it runs on one machine with one user. It doesn't run on a different machine. It forces to use the same user/group IDs on host machine... Sad :(

LaurentGoderre commented 5 months ago

Not sure exactly because there isn't enough details but It's possible that it worked when it is built on a machine where the use building already have UID 1000 (typical installation in many linux distributions) and doesn't work when built on. a machine where the user has a different UDI