【发布时间】:2021-05-14 14:43:28
【问题描述】:
我正在尝试 Dockerize 一个运行 shell 脚本的 pm2 服务器,但我不断收到此错误
PM2 error: Error: Interpreter bash is NOT AVAILABLE in PATH。 shell 脚本直接在终端中运行,并且能够记录“测试”,当我在没有 pm2 的 Docker 中运行 shell 脚本时,也会记录“测试”。我尝试使用命令which bash 来获取正确的路径,它返回/usr/bin/bash。路径已添加到配置文件中,但错误仍然存在。
start.sh
#!/bin/sh
echo "Testing"
生态系统.config.js
module.exports = {
apps: [{
script: './start.sh',
intepreter: '#!/bin/sh',
}]
};
Docker 文件
FROM keymetrics/pm2:latest-alpine
COPY . .
RUN npm install pm2 -g
ENV PM2_PUBLIC_KEY <public key>
ENV PM2_SECRET_KEY <secret key>
COPY ecosystem.config.js .
CMD ["chmod", "+x", "./start.sh"]
CMD ["pm2-runtime","start","ecosystem.config.js"]
我收到错误
PM2 error: Error: Interpreter bash is NOT AVAILABLE in PATH
【问题讨论】:
标签: bash docker shell devops pm2