2

我正在尝试将 Chronos 配置为使用https://github.com/mesosphere/mesos-docker/上的自定义 mesos-docker 执行程序。每次我尝试运行命令它都会失败。

我使用以下命令创建了任务

echo '{"schedule":"R/2014-02-14T00:52:00Z/PT90M", "name":"testing_docker_executor", "command":"docker_ubuntu_test /root/docker_test.sh", "epsilon":"PT15M", "executor":"/var/lib/mesos/executors/docker" }' | http POST localhost:8080/scheduler/iso8601

我还在执行程序中配置了日志记录,下面是我在失败时得到的日志

Feb 11 13:51:36 ip6-localhost docker[13895]: Ready to serve!
Feb 11 13:51:36 ip6-localhost docker[13895]: Registered with Mesos slave
Feb 11 13:51:36 ip6-localhost docker[13895]: Task is: ct:1392126755612:2:testing_docker_executor
Feb 11 13:51:36 ip6-localhost docker[13895]: JSON from framework is rubbish
Feb 11 13:51:36 ip6-localhost docker[13895]: No JSON object could be decoded
Feb 11 13:51:36 ip6-localhost docker[13895]: Traceback (most recent call last):
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/var/lib/mesos/executors/docker", line 120, in launchTask
Feb 11 13:51:36 ip6-localhost docker[13895]:     self.data = json.loads(task.data) if task.data else {}
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
Feb 11 13:51:36 ip6-localhost docker[13895]:     return _default_decoder.decode(s)
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
Feb 11 13:51:36 ip6-localhost docker[13895]:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
Feb 11 13:51:36 ip6-localhost docker[13895]:     raise ValueError("No JSON object could be decoded")
Feb 11 13:51:36 ip6-localhost docker[13895]: ValueError: No JSON object could be decoded
Feb 11 13:51:36 ip6-localhost docker[13895]: []
Feb 11 13:51:36 ip6-localhost docker[13895]: Traceback (most recent call last):
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/var/lib/mesos/executors/docker", line 67, in run
Feb 11 13:51:36 ip6-localhost docker[13895]:     img  = self.args[0]
Feb 11 13:51:36 ip6-localhost docker[13895]: IndexError: list index out of range

有什么我想念的吗。我是否需要在命令中提供 JSON。

4

3 回答 3

0

I have forked and customized the mesos-docker script by @solidsnack. It can be found at https://github.com/mudasirmirza/chronos-docker

This script works perfectly fine with Mesos and Chronos without Marathon.

Usage and examples are in the readme.

于 2014-02-15T02:38:32.237 回答
0

中似乎提供了数据,TaskInfo但我不确定这是从哪里来的。Docker 执行器期望,如果提供了数据,它是由 Marathon 提供的,并且应该是 JSON。显然里面还有别的东西。

至于第二个错误——list index out of range这表明它docker_ubuntu_test /root/docker_test.sh没有被传递给 Docker 执行器。这确实很奇怪。

于 2014-02-12T05:55:49.533 回答
0

您需要image为 mesos 提供一个 docker 以在您的 json 中运行。它应该看起来更像这样。

{ 
    "schedule" : "R5/2014-11-12T05:31:00.000Z/PT10S",  
    "epsilon" : "PT10M",  
    "name" : "ECHO_DATE_DOCKER",
    "container": {
    "type": "DOCKER",
    "image": "libmesos/ubuntu"
    },
    "cpus": "0.5",
    "mem": "256",   
    "command" : "date >> /tmp/ECHO_DATE_01",  
    "owner" : "chronos-user@example.com",  
    "async" : false 
}

这里有更多例子

于 2015-06-26T03:17:55.350 回答