1

After deploying a Python Docker container and successfully executing a script the container crashes and restarts in a loop after showing the following error message:

2017-06-19 13:22:49 [APP/PROC/WEB/0] OUT Exit status 0
2017-06-19 13:22:49 [CELL/0] OUT Exit status 0
2017-06-19 13:22:49 [CELL/0] OUT Destroying container
2017-06-19 13:22:49 [API/0] OUT Process has crashed with type: "web"
2017-06-19 13:22:49 [API/0] OUT App instance exited with guid 85e7922e-5a0c-4430-994a-324e5abc0c14 payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* Codependent step exited\n* cancelled", "crash_count"=>1, "crash_timestamp"=>1497871369566402154, "version"=>"b9800e3a-b057-4cc5-b7e4-c01f9b3c6594"}

Executing the same docker image locally it does not throw any errors. The Python script I execute is doing a simple print command and I even implemented a handler for the SIGTERM signal that is sent into the container after execution.

3
  • Looks like a normal termination: Exit status 0 not like a crash. It seems something tries to restart the container. Commented Jun 19, 2017 at 11:41
  • Running the same application on a local Docker executes the script properly and destroys the container. However on CloudFoundry it restarts the container in a loop. Commented Jun 19, 2017 at 11:50
  • I have no experience with CloudFoundry. Did you specifiy somewhere the restart behaviour of the container. Commented Jun 19, 2017 at 12:06

1 Answer 1

3

In CF, applications are not supposed to finish. But if your script only just prints something, it'll perform an exit 0 afterwards. Thus the app container is stopped and CF registers a "crash", and will then restart the application in accordance with the app lifecycle: https://docs.cloudfoundry.org/devguide/deploy-apps/app-lifecycle.html

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the enlightment. Is there a solution to fix the reboot? I do not mind the crash but I do not want the container to restart all the time.
@user3080315 I don't think so, as apps are supposed to be always running. You'd have to implement some kind of workaround, like stopping the app from outside once it has crashed or adding an endless loop (with nothing but a long sleep in it) at the end of the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.