Docker容器运行错误:容器退出时出错:退出状态为1

时间:2016-06-09 05:01:29

标签: docker mesos marathon

我在马拉松中运行依赖应用程序,一个是mongo DB,另一个是karesti投票应用程序。我已经在docker容器中的马拉松中部署了这些应用程序。首先,我部署了mongo db和更高版本的投票应用程序。

mongo db docker image在马拉松中运行良好。 问题在于投票应用.... 投票应用程序在运行模式和挂起模式之间连续切换。因此,端口号在每个部署中也会发生变化,新容器正在为同一图像创建docker。

这里我有用于服务发现的mesos DNS。

马拉松错误:

  

Docker容器运行错误:容器退出时出错:退出   状态1

投票应用程序出错:

  

收到任务的killTask   cmvoting.dff585d5-2bc5-11e6-a4c0-0242efa3f3aa

Log message from mesos slave: 
I0607 07:24:04.297161  1957 slave.cpp:3243] Handling status update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 from executor(1)@127.0.0.1:50983
I0607 07:24:04.299815  1957 status_update_manager.cpp:320] Received status update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:04.300282  1957 status_update_manager.cpp:824] Checkpointing UPDATE for status update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:04.391424  1957 slave.cpp:3641] Forwarding the update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 to master@172.31.29.198:5050
I0607 07:24:04.391826  1957 slave.cpp:3551] Sending acknowledgement for status update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 to executor(1)@127.0.0.1:50983
I0607 07:24:04.421507  1951 status_update_manager.cpp:392] Received status update acknowledgement (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:04.421766  1951 status_update_manager.cpp:824] Checkpointing ACK for status update TASK_RUNNING (UUID: ed039d5b-ef25-45e5-962f-367feaa33ae5) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001


I0607 07:24:18.299789  1956 slave.cpp:3243] Handling status update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 from executor(1)@127.0.0.1:50983
I0607 07:24:18.321115  1953 status_update_manager.cpp:320] Received status update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:18.321229  1953 status_update_manager.cpp:824] Checkpointing UPDATE for status update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:18.338953  1956 slave.cpp:3641] Forwarding the update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 to master@172.31.29.198:5050
I0607 07:24:18.339341  1956 slave.cpp:3551] Sending acknowledgement for status update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 to executor(1)@127.0.0.1:50983
I0607 07:24:18.350075  1954 status_update_manager.cpp:392] Received status update acknowledgement (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:18.350272  1954 status_update_manager.cpp:824] Checkpointing ACK for status update TASK_FAILED (UUID: e20d07aa-88e1-497b-9c51-79252c279f27) for task voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3 of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001
I0607 07:24:19.301136  1951 slave.cpp:3769] executor(1)@127.0.0.1:50983 exited
I0607 07:24:19.327797  1953 docker.cpp:2011] Executor for container 'd4447d21-23da-45db-a9aa-f6b2d75e2db7' has exited
I0607 07:24:19.327910  1953 docker.cpp:1731] Destroying container 'd4447d21-23da-45db-a9aa-f6b2d75e2db7'
I0607 07:24:19.328034  1953 docker.cpp:1859] Running docker stop on container 'd4447d21-23da-45db-a9aa-f6b2d75e2db7'
I0607 07:24:19.328732  1958 slave.cpp:4120] Executor 'voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3' of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 exited with status 0
I0607 07:24:19.328843  1958 slave.cpp:4224] Cleaning up executor 'voting.cfc5c791-2c80-11e6-b454-0242f9dcd7c3' of framework 4925c40b-fb4b-4ec7-91fc-3ffc16e1bac8-0001 at executor(1)@127.0.0.1:50983

我无法确定问题所在,为什么投票应用程序在奴隶中失败。

如果我从裸ubuntu机器运行投票,我可以访问已连接到数据库的应用程序,一切正常。这表明应用程序没有问题,docker镜像没有问题。

我怀疑是,mesos slave中发生了一些无法处理或无法连接到数据库的事情。

我的mongo db听端口27017并且投票app听端口9000.我可以看到当我执行netstat -anp时,只有端口27017被使用grep 27017

用于运行从站的命令是

sudo ./bin/mesos-slave.sh --master=zk://172.31.36.222:2181/home/ubuntu/mesos --executor_registration_timeout=5mins --containerizers="docker,mesos"

用于运行马拉松的命令是

./bin/start --master zk://172.31.36.222:2181/home/ubuntu/mesos --zk zk://172.31.36.222:2181/home/ubuntu/marathon-1.1.1 --task_launch_timeout 600000

如果您需要更多关于问题的信息或清晰度,请告诉我

提前感谢您的帮助......

2 个答案:

答案 0 :(得分:1)

问题的一部分可能是您的奴隶绑定到127.0.0.1 IP地址。请尝试在您的奴隶上设置非本地地址,如下所示:

echo 172.31.36.223 | sudo tee /etc/mesos-slave/ip
sudo cp /etc/mesos-slave/ip /etc/mesos-slave/hostname

172.31.36.223替换为您的奴隶的真实IP地址。

另一部分可能是投票应用程序无法连接到MongoDB,因为端口号不同。您还应该发布Marathon应用程序定义,以便验证这一点。

如果您只有一个从属设备,则可以在HOST网络模式下运行这两个应用程序,以便您可以静态定义端口号。如果您正在使用桥接模式,则需要使用某种服务发现机制,以便投票应用程序可以找到MongoDB服务器。

答案 1 :(得分:0)

我感谢我的反应......

我找到了解决这个问题的方法

DNS从/etc/resolv.conf和/ etc / hosts文件中查找正确的IP地址

我从/ etc / hosts文件中删除了本地主机IP地址,其中DNS试图从127.0.0.1解析,这是外部世界所不知道的。我提供了我的虚拟机专用IP地址,该地址与DNS配置文件中提供的相同