marathon does not delete a docker container after destroying the job
Marathon will restart a docker container which failed so that you have the number of instances you requested. It could be that you see stopped/failed containers which were not cleaned up by Mesos. This could be related to the fact that Mesos delays container cleanup until GC. see https://issues.apache.org/jira/browse/MESOS-1656
It is the behavior of Marathon, because it is meant for long running services, as soon the task is completed, Marathon assumes it has been terminated in that host and immediately it will assign a new instance for running the application. If you need one of task you can use Chronos, so it makes the task to run only one time. I have written a script to do this automatically for marathon.
start=$1end=$2for (( c=$start; c<=$end; c++ ))do echo "deleting:$c" sleep 10 var=$(curl -X GET http://localhost:8080/v2/apps/docker-app-$c | grep "startedAt") echo "$var" if [[ $var == *"startedAt"* ]] then curl -X DELETE http://localhost:8080/v2/apps/docker-app-$c echo "going to delete" else echo "application not started yet" fi sleep 1doneecho "Completed!"