Kubernetes restarting pods

4/28/2016

I have containerized node js app running on kubernetes which has volume mounted to host.

For development purpose when there is any change in the host volume dir / files the node app should restart.

In Dockerfile i have

CMD ["forever", "index.js"]

This will just start the app when container starts, but it is not restarting when the change occurs.

I have cross checked and made sure that changes are syncing properly from host volume to container

-- sravis
docker
dockerfile
forever
kubernetes
node.js

1 Answer

4/28/2016

forever needs a flag to restart on file changes. Try with:

CMD ["forever", "-w", "index.js"]

I tend to use nodemon in development because it watches file changes by default and won't try to restart the app if it fails (only a file change triggers a start), forever will try to restart forever.

-- Shanoor
Source: StackOverflow