我刚刚阅读了有关Global npm dependencies的最佳做法,并尝试在我的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
但是当我尝试启动容器时,我得到了:
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
我只是不明白我做错了什么..
获取的Dockerfile中设置PATH环境变量