Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

marathon does not delete a docker container after destroying the job

when I run a docker container as a marathon job, it creates a docker container in the active mesos slave system. when suspend or destroy the docker job what I expect that marathon should delete the docker container as its no longer required. But the container does not get deleted. I have to delete them manually every time marathon restart a docker container job.

is there any way to delete these unwanted containers automatically?

Edit: Adding json file for initiating a marathon job

{
  "id": "pga-docker",
  "cmd":"sh pga-setup.sh",
  "cpus": 0.5,
  "mem": 1024.0,
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "pga:test",
      "parameters": [
        { "key": "env", "value": "SERVER_HOST=value" },
        { "key": "env", "value": "SERVER_PORT=value" }
      ],
      "network": "BRIDGE",
      "portMappings": [
        { "containerPort": 80, "hostPort": 0}
      ]
    }
  }
}
like image 662
psaha4 Avatar asked Jul 30 '15 17:07

psaha4


1 Answers

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

like image 199
Aliza Avatar answered Oct 14 '22 22:10

Aliza