So i have a running container with node js app inside of it (express). The docker container has restart: always policy and when the app crashes, the container doesn't pick up that crash so it doesn't restart. My question is how do i make the container notice that my app crashed? Or do i use extra libraries like forever or pm2(which will keep my app running from INSIDE container) or how do i handle this specific case?
Asked
Active
Viewed 1,303 times
1
-
Please provide a [mcve] demonstrating the issue. Knowing what the main container process is would be helpful. – David Maze Oct 13 '20 at 20:01
-
1You need to make sure that your main process ends when the application fails. See this post that explains about it. https://stackoverflow.com/q/29680274/6710366 – André Carvalho Oct 13 '20 at 20:26
-
The main process basically is: NODE_ENV=production node server.js. The problem occurred when i try to do social login (not that much important) that crashed my express app. After checking logs i found where it crashed. So yea you are probably right somewhere in my code i don't handle that error -> i don't end process (i will try to fix it, if problem occurs again) – Blagoj Petrov Oct 14 '20 at 00:56