我正在尝试将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。
答案 0 :(得分:0)
TaskInfo
似乎提供了数据,但我不确定这是从哪里来的。 Docker执行程序期望,如果提供了数据,它是由Marathon提供的,应该是JSON。显然其他东西在那里。
关于第二个错误 - list index out of range
- 这表明docker_ubuntu_test /root/docker_test.sh
没有传递给Docker执行程序。这确实很奇怪。
答案 1 :(得分:0)
我已经通过@solidsnack分叉并自定义了mesos-docker脚本。它可以在 https://github.com/mudasirmirza/chronos-docker
这个脚本与没有Marathon的Mesos和Chronos完美搭配。
用法和示例在自述文件中。
答案 2 :(得分:0)
您需要为您的json中运行的mesos提供一个docker image
。看起来应该更像这样。
{
"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
}
还有更多示例here