Search code examples
dockermesosmesospheremarathon

Docker container on Marathon doesn't finish


I have Mesos cluster consists of 3 CentOS6.5 machines.

ZooKeeper and Mesos-Master is running on one of the machines and Mesos-Slave is running on each machine.

Also, Marathon is running on master node.

Then, I am trying to run docker containers on Marathon, following this instruction by Mesosphere.

job.json is like as follows,

{
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "libmesos/ubuntu"
    }
  },
  "id": "ubuntu",
  "instances": 1,
  "cpus": 0.5,
  "mem": 512,
  "uris": [],
  "cmd": "date -u +%T"
}

Then I run following command,

curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" <master-hostname>:8080/v2/apps [email protected]

Then on Marathon Web UI, I can see the Docker container is "Deploying" status even after long time.

And on Mesos-Master Web UI, I can see the Task is in "STAGING" status after long time.

On Sandbox pane, I can see the stdout and the command seems to completed successfly. No problem.

stderr is like this,

I0416 19:19:49.254998 29178 exec.cpp:132] Version: 0.22.0
I0416 19:19:49.257824 29193 exec.cpp:206] Executor registered on slave 20150416-160950-109643786-5050-30728-S0

stdout is like this,

Registered executor on master-hostname
10:19:49

But I expect the container(TASK) to finish after completed the command. Is it possible? If possible, how to do that way?

Thank you.


Solution

  • The task will finish (you should be able to see in the Mesos completed tasks) but the container will be restarted by Marathon. Marathon is for long-running apps.

    If you don't want your application to be running continuously, you should take a look at another framework like Chronos.