主机正在运行MacOS X High Sierra
在Docker容器中运行NodeJS应用。
使用Docker PM2集成即pm2-runtime
Docker版本
$ docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:13:16 2018
OS/Arch: darwin/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:23:05 2018
OS/Arch: linux/amd64
Experimental: true
Docker文件
FROM node:alpine
COPY . ./app
WORKDIR /app
RUN npm install --no-optional
RUN npm install bcrypt --no-optional
RUN npm install bcrypt pm2 --no-optional
ENV NODE_ENV staging
CMD ["pm2-runtime", "ecosystem.config.json"]
EXPOSE 3000
EXPOSE 8443
运行日志
docker run -p 3000:3000 -p 8443:8443 -i -t wrapper:0.2
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"pm2-runtime\": executable file not found in $PATH": unknown.
有指针吗?
最佳答案
像全局安装pm2npm install pm2 -g
或通过pm2-runtime完整路径。
关于docker - 在$ PATH中找不到pm2-runtime可执行文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50002748/