I have created an image from the following Dockerfile.
FROM alpine
WORKDIR /usr/src/app
RUN apk add nodejs-current
RUN apk add nodejs-npm
RUN npm install pm2 -g
COPY process.yaml .
CMD pm2 start process.yaml --no-daemon --log-date-format 'DD-MM
HH:mm:ss.SSS'
process.yaml
looks like this:
- script: ./run-services.sh
watch : false
But run-services.sh
does not run in my docker. What is the problem?
The problem is that in alpine the bash
is not installed by default. pm2
runs bash scripts files by bash
command. so there is two way to solve the problem:
Changing default pm2
interpreter from bash
to /bin/sh
- script: ./run-services.sh
interpreter: /bin/sh
watch : false
Installing bash
in alpine. So the Dockerfile changes as following:
FROM alpine
RUN apk update && apk add bash
WORKDIR /usr/src/app
RUN apk add nodejs-current
RUN apk add nodejs-npm
RUN npm install pm2 -g
COPY process.yaml .
CMD pm2 start process.yaml --no-daemon --log-date-format 'DD-MM
HH:mm:ss.SSS'