<blockquote>
  <p>Is there a way to know if an app has crashed inside docker</p>
</blockquote>

<p>If your app is writing logs and is the main process in that container, then yes, just watch them</p>

<blockquote>
  <p>am implementing CI/CD and want to stop container when it crashes on auto-deploy</p>
</blockquote>

<p>What's your tools used for CI/CD? For example, when you are releasing an app with <code>kubectl apply</code> you can wait till automated deployment succeed: <code>kubectl rollout status</code></p>

CC BY-SA 4.0
2020-06-10T21:13:30.590Z
I updated the question with the missing details
lulliezy
CC BY-SA 4.0
2020-06-12T20:57:45.920Z
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
CC BY-SA 4.0
2020-06-09T21:09:03.043Z
2020-06-09T21:09:03.043Z
Hakob
<p>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 <strong>Jenkins</strong> and will be deploying the built app via <code>ssh</code> to the main server and want to stop container when it crashes on auto-deploy.</p>

<docker><jenkins><jenkins-pipeline><docker-compose>
Docker calls to detect app crashing inside it
lulliezy
# Docker calls to detect app crashing inside it

(Asked by: username_0 on 2020-06-06)

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.

**Tags:** docker, jenkins, jenkins-pipeline, docker-compose


---

## 1 answers

### Answer by username_1 on 2020-06-09. Score: 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`

> **Comments:**
> **username_0**: I updated the question with the missing details  
> **username_1**: 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.  

---

