2

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.

2

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

| improve this answer | |
  • I updated the question with the missing details – lulliezy Jun 10 at 21:13
  • 2
    I 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 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.