How to copy files and execute pm2 with dockerView other answers to this thread
3.4K+ developers have started their personal blogs on Hashnode in the last one month.
Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more
You could have a look at the logs first... It might help you figure out what's the problem:
docker logs backend
You can try to use the following Dockerfile:
FROM keymetrics/pm2-docker-alpine RUN npm install pm2 -g WORKDIR /pm COPY . /pm/ CMD ["pm2-docker", "ecosystem.config.js"]
WORKDIR instruction will create a new
/pm folder in the container and set this folder as the working directory for the next
CMD commands, see: docs.docker.com/engine/reference/builder/#w..
CMD instruction, there is no need to specify the path to the
ecosystem.config.js file as it should be copied in the
/pm directory which is the working directory.
Give it a try.