Is there a way to know if an app has crashed inside docker using maybe bash script or API call from host container, am implementing CI/CD using Jenkins and will be deploying the built app via ssh
to the main server and want to stop container when it crashes on auto-deploy.
Is there a way to know if an app has crashed inside docker
If your app is writing logs and is the main process in that container, then yes, just watch them
am implementing CI/CD and want to stop container when it crashes on auto-deploy
What's your tools used for CI/CD? For example, when you are releasing an app with kubectl apply
you can wait till automated deployment succeed: kubectl rollout status
-
-
2I think it's a bit sticky method to read the output of your app and respond to crashes appropriately. In this case, the only solution is to implement a kind like liveness probe for your app. Measure the average time to become available and before closing the SSH session, at the end of the script after sleeping that time just check your app's health. Either make a request and compare with predefined response status and/or payload or check the presence of errors in
stderr
stream of the app. – Hakob Jun 12 '20 at 20:57