nodejs / docker-node

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

Odd Permission Error #405

Closed orion110217 closed 7 years ago

orion110217 commented 7 years ago

I have an app that serves html files generated by EJS, and semantic-ui as my css, the problem is while running nodejs as root, it is not safe so i decided to create a non root user in the Dockerfile, this in turn throws EACCESS error in semantic fonts:

Error: EACCES: permission denied, stat '/usr/src/app/public/css/themes/default/assets/fonts/icons.woff2' Error: EACCES: permission denied, stat '/usr/src/app/public/css/themes/default/assets/fonts/icons.woff' Error: EACCES: permission denied, stat '/usr/src/app/public/css/themes/default/assets/fonts/icons.ttf'

Is there any alternative to the non root user, or am i need to use chown after creating the user?

LaurentGoderre commented 7 years ago

All of our images already contain a non-root user for this purpose. The user is called node

LaurentGoderre commented 7 years ago

Your app should reside in /home/node/app

orion110217 commented 7 years ago

Where can i read about that? Sorry to ask about that, anything that I can learn is very valuable to me. Thank you! I will try it.

LaurentGoderre commented 7 years ago

https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user

orion110217 commented 7 years ago

Oh god, I can't believe I missed that. Thank you!