I've just read the best practices about Global npm dependencies and tried to utilize this approach in my Dockerfile:
FROM node:carbon
...
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH="/home/node/.npm-global:${PATH}"
...
RUN npm install -g nodemon
...
CMD ["nodemon", "server.js"]
USER node
But when I try to start the container I get:
ERROR: for my_project_node_1 Cannot start service my_project_node:
OCI runtime create failed: container_linux.go:296:
starting container process caused "exec: \"nodemon\":
executable file not found in $PATH": unknown
ERROR: for my_project_node Cannot start service my_project_node:
OCI runtime create failed: container_linux.go:296:
starting container process caused "exec: \"nodemon\":
executable file not found in $PATH": unknown
I just don't understand what I do incorrectly..
How to set PATH environment variable in a Dockerfile I get from here https://stackoverflow.com/a/38742545/202550