pm2 command not working from a docker image

  containers, docker, node.js, pm2, process

I have a pm2 command in my docker file which should run inside container when the container starts:

CMD ["pm2", "start", "ecosystem.local.json"]

but seems like this command doesnt run because when i go inside the container and run pm2 list manually then i dont see any process running.

But when i run the same above commands from inside the container manually:

pm2 start ecosystem.local.json
pm2 list

then i can see my process running.

So why the command CMD ["pm2", "start", "ecosystem.local.json"] doesnt run automatically from the docker file/image?

Source: Docker Questions

LEAVE A COMMENT