sravis
sravis

Reputation: 3680

Kubernetes restarting pods

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

Upvotes: 0

Views: 1180

Answers (1)

Shanoor
Shanoor

Reputation: 13692

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.

Upvotes: 2

Related Questions