错误Docker在Amazon EC2中部署 - Docker容器意外退出 [英] Error Docker deployment in Amazon EC2 - Docker container quit unexpectedly

查看:684
本文介绍了错误Docker在Amazon EC2中部署 - Docker容器意外退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Amazon EC2中部署Dockerfile和Dockerrun.aws.json。我能够成功创建Docker容器,但之后,该实例正在崩溃。我不知道为什么 Docker容器意外退出或如何修复它。



日志:

 步骤36:运行服务apache2 stop& &安培; service apache2 start 
--->运行在1531cdba4bf1
停止Web服务器:apache2。
[91m / usr / sbin / apache2ctl:87:ulimit:错误设置限制(不允许操作)
[0m [91m设置ulimit失败。有关详细信息,请参阅README.Debian。
[0m [91mAH00558:apache2:使用172.17.0.32无法可靠地确定服务器的全限定域名。设置全局的ServerName指令以消除此消息
[0m启动Web服务器:apache2。

---> 86403887587f
删除中间容器1531cdba4bf1
步骤37:EXPOSE 80
--->运行在395114dad85b
---> 7350f1436bc2
删除中间容器395114dad85b
成功构建7350f1436bc2
成功构建aws_beanstalk / staging-app
[2015-04-21T15:16:46.558Z] INFO [1799] - [CMD -Startup / StartupStage0 / AppDeployPreHook / 04run.sh]:开始活动...
[2015-04-21T15:16:54.493Z] INFO [1799] - [CMD-Startup / StartupStage0 / AppDeployPreHook / 04run.sh ]:活动执行失败,因为:命令失败,出现错误代码1:/opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh
d84f98c9e97a7287ca461510866d32adec0da73cbe5a7abcb8201490332a0f48
启动后意外的Docker容器退出:Docker容器意外退出星期二4月21日15:16:54 UTC 2015:检查快照日志的详细信息。 (Executor :: NonZeroExitStatus)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in`sh'来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in的
来自/ opt / /bean / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / executable.rb:63:在`execute!'
from / opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in`block(2 levels)in run!'

日志中的其他信息:

 code> Docker容器在启动后意外退出:Docker容器意外地在Tue Apr 21 15:16:54 UTC 2015:。检查快照日志的详细信息。 (Executor :: NonZeroExitStatus)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in`sh'来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in的
来自/ opt / /bean / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / executable.rb:63:在`execute!'
from / opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in`block(2 levels)in run!'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in`call'
from / opt /弹性豆串/ lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:169:在`exec'
from / opt / elasticbeanstalk / lib / ruby / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:126:在`timeout_exec'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in`block in create'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`instance_eval'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`create'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / hook-directory-executor.rb:28:在`block in run!'
from / opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:26:ineach
from / opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:26:in`run!'
from / opt / elasticbeanstalk / LIB /红宝石/ LIB /红宝石/宝石/ 2.1.0 /宝石/豆茎核-1.1 / LIB / elasticbeans talk / command.rb:215:在`block(3级)在exec_stage'
从/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/ lib / elasticbeanstalk / activity.rb:169:在`call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/ activity.rb:169:在`exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb: 126:在`timeout_exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in`在/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:ininstance_eval中创建'
'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`create'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core -1.1 / lib / elasticbeanstalk / command.rb:209:在exec_stage中的`block(2级)'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk -core-1.1 / lib / elasticbeanstalk / command.rb:207:在每个
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1 /lib/elasticbeanstalk/command.rb:207:in`each_with_index'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk /command.rb:207:in`block in exec_stage'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity .rb:169:在`call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169 :在`exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in`timeout_exec来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1的
.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:110:在`block in create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0 /gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`instance_eval'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk -core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1 /lib/elasticbeanstalk/command.rb:204:in`exec_stage'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk /command.rb:158:in`execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command。 rb:68:在`run'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb: 64:在`block(2级)执行!'
从/ opt / elasticbeanstalk / l ib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:169:在`call'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:169:在`exec'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:126:在`timeout_exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1。 0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:110:在`block in create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/ gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`instance_eval'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk- core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/ lib / elasticbeanstalk / command-processor.rb:62:在`block in execute!'
from / opt / e lasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / command-processor.rb:106:在`execute_command'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / command-processor.rb:60:在`execute!'
from / opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/bin/command-processor:46:in`< top(required)>'
from / opt / elasticbeanstalk / lib / ruby​​ / bin / command-processor:23:在`load'
from / opt / elasticbeanstalk / lib / ruby​​ / bin / command-processor:23:在`< main>'



[2015-04-21T15:16:54.494Z] INFO [1799] - [CMD-Startup / StartupStage0 / AppDeployPreHook / 04run.sh]:活动失败。
[2015-04-21T15:16:54.494Z] INFO [1799] - [CMD-Startup / StartupStage0 / AppDeployPreHook]:活动失败。
[2015-04-21T15:16:54.494Z] INFO [1799] - [CMD-Startup / StartupStage0]:活动失败。
[2015-04-21T15:16:54.500Z]信息[1799] - [CMD启动]:已完成活动。结果:
命令CMD-Startup(stage 0)失败。
[2015-04-21T15:17:01.435Z] INFO [31657] - [CMD-TailLogs]:开始活动...
[2015-04-21T15:17:02.355Z] INFO [ 31657] - [CMD-TailLogs / AddonsBefore]:开始活动...
[2015-04-21T15:17:02.355Z] INFO [31657] - [CMD-TailLogs / AddonsBefore]:已完成活动。
[2015-04-21T15:17:02.356Z] INFO [31657] - [CMD-TailLogs / TailLogsDockerPS]:开始活动...
[2015-04-21T15:17:02.356Z]信息[31657] - [CMD-TailLogs / TailLogsDockerPS / DockerPS]:开始活动...
[2015-04-21T15:17:02.396Z] INFO [31657] - [CMD-TailLogs / TailLogsDockerPS / DockerPS] :已完成活动。
[2015-04-21T15:17:02.396Z] INFO [31657] - [CMD-TailLogs / TailLogsDockerPS]:已完成活动。结果:
命令CMD-TailLogs stage 0完成。
[2015-04-21T15:17:02.396Z] INFO [31657] - [CMD-TailLogs / TailLogs]:开始活动...
[2015-04-21T15:17:02.396Z]信息[31657] - [CMD-TailLogs / TailLogs / TailLogs]:开始活动...
[2015-04-21T15:17:02.858Z]信息[31657] - [CMD-TailLogs / TailLogs / TailLogs] :已完成活动。
[2015-04-21T15:17:02.858Z] INFO [31657] - [CMD-TailLogs / TailLogs]:已完成活动。结果:
命令CMD-TailLogs第1阶段完成。
[2015-04-21T15:17:02.859Z] INFO [31657] - [CMD-TailLogs / AddonsAfter]:开始活动...
[2015-04-21T15:17:02.859Z]信息[31657] - [CMD-TailLogs / AddonsAfter]:已完成活动。
[2015-04-21T15:17:02.859Z] INFO [31657] - [CMD-TailLogs]:已完成活动。结果:
命令CMD-TailLogs成功。
[2015-05-06T12:25:45.126Z] INFO [20429] - [CMD-TailLogs]:开始活动...
[2015-05-06T12:25:45.601Z] INFO [ 20429] - [CMD-TailLogs / AddonsBefore]:开始活动...
[2015-05-06T12:25:45.602Z] INFO [20429] - [CMD-TailLogs / AddonsBefore]:已完成活动。
[2015-05-06T12:25:45.602Z] INFO [20429] - [CMD-TailLogs / TailLogsDockerPS]:开始活动...
[2015-05-06T12:25:45.602Z] INFO [20429] - [CMD-TailLogs / TailLogsDockerPS / DockerPS]:开始活动...
[2015-05-06T12:25:45.640Z] INFO [20429] - [CMD-TailLogs / TailLogsDockerPS / DockerPS] :已完成活动。
[2015-05-06T12:25:45.640Z] INFO [20429] - [CMD-TailLogs / TailLogsDockerPS]:已完成活动。结果:
命令CMD-TailLogs stage 0完成。
[2015-05-06T12:25:45.641Z] INFO [20429] - [CMD-TailLogs / TailLogs]:开始活动...
[2015-05-06T12:25:45.641Z] INFO [20429] - [CMD-TailLogs / TailLogs / TailLogs]:开始活动...



-------------- -----------------------
/var/log/docker-ps.log
--------- ----------------------------
'docker ps'运行于Wed May 6 12:25:45 UTC 2015:
CONTAINER ID图像命令创建的状态名称名称



----------------------- --------------
/var/log/eb-commandprocessor.log
------------------来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1的-------------------
/lib/elasticbeanstalk/hook-directory-executor.rb:26:in`run!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core- 1.1 / lib / elasticbeanstalk / command.rb:215:在`block(3级)在exec_stage'
从/ opt / ela sticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:169:在`call'
from / opt / elasticbeanstalk / lib / ruby / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:169:在`exec'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:126:在`timeout_exec'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:110:在`block in create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1。 0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`instance_eval'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/ beanstalk-core-1.1 / lib / elasticbeanstalk / activity.rb:109:在`create'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core- 1.1 / lib / elasticbeanstalk / command.rb:209:在exec_stage中的`block(2级)'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:ineach
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in`each_with_index'
来自/ opt / elasticbeanstalk /lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in`在exec_stage中阻止'
从/ opt / elasticbeanstalk / lib /ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in从/ opt / elasticbeanstalk / lib / ruby​​ / lib的`call'
/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in`exec'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0的/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in`timeout_exec'
/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in`block in cre ate'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`instance_eval'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`create'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / command.rb:204:在`exec_stage'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / command.rb:158:在`execute!'
from / opt / elasticbeanstalk / lib / ruby /lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:68:in'run'
from / opt / elasticbeanstalk / lib / ruby​​ / lib / ruby /gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:64:in`block(2级)在执行!'
从/ opt / elasticbeanstalk / lib /红宝石/ LIB /红宝石/宝石/ 2.1.0 /宝石/豆茎核-1.1 / LIB / elasticbeanstalk / activit y.rb:169:在`call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb: 169:在`exec'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in`来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in的block_exec'

来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`instance_eval'
来自/opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in`create'
from / opt / /bean / lib / ruby​​ / lib / ruby​​ / gems / 2.1.0 / gems / beanstalk-core-1.1 / lib / elasticbeanstalk / command-processor.rb:62:在`block in execute!'
from / opt /elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elastic beanstalk / command-processor.rb:106:在`execute_command'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/ command-processor.rb:60:在`execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/bin/command-processor :46:在`< top(required)>'
from / opt / elasticbeanstalk / lib / ruby​​ / bin / command-processor:23:在`load'
from / opt / elasticbeanstalk / lib / ruby​​ / bin / command-processor:23:在`< main>'



[2015-04-21T15:16:54.500Z]错误[1799 ]:命令CMD启动(阶段0)失败!
[2015-04-21T15:16:54.503Z] INFO [1799]:命令处理器返回结果:
{status:FAILURE,api_version:1.0,truncated :false,results:[{status:FAILURE,msg:[CMD-Startup / StartupStage0 / AppDeployPreHook / 04run.sh])失败,出现错误代码1:/ opt / elasticbeanstalk / hooks /appdeploy/pre/04run.sh\\\
d84f98c9e97a7287ca461510866d32adec0da73cbe5a7abcb8201490332a0f48\\\
Docker容器在启动后意外退出:Docker容器意外地在Tue Apr 21 15:16:54 UTC 2015:。检查快照日志的详细信息。,returncode:1 ,事件:[{msg:成功地拉chuseuiti / pynusci:最新,严重性:TRACE,时间戳:1429627195},{msg:成功构建aws_beanstalk / staging-app ,severity:TRACE,timestamp:1429629406},{msg:Docker容器在启动后意外退出:Docker容器意外退出在星期二4月21日15:16:54 UTC 2015年:检查快照日志详细信息,severity:ERROR,timestamp:1429629414}]}}}
[2015-04-21T 15:17:01.431Z] DEBUG [31657]:阅读配置文件:/etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-04-21T15:17:01.431Z] DEBUG [31657]:检查命令处理器是否应该执行。
[2015-04-21T15:17:01.435Z] DEBUG [31657]:检查命令是否适用于实例(i-c3213b14)..
[2015-04-21T15:17:01.435 Z] INFO [31657]:命令适用于此实例(i-c3213b14)..
[2015-04-21T15:17:01.435Z]调试[31657]:检查接收到的命令阶段是否有效。 。
[2015-04-21T15:17:01.435Z] INFO [31657]:没有stage_num命令。有效的阶段..
[2015-04-21T15:17:01.435Z] INFO [31657]:命令处理器应该执行命令。
[2015-04-21T15:17:01.435Z] DEBUG [31657]:存储当前阶段
[2015-04-21T15:17:01.435Z]调试[31657]:Stage_num不存在。不保存空位。返回..
[2015-04-21T15:17:01.435Z]信息[31657]:执行命令:CMD-TailLogs ...
[2015-04-21T15:17:01.436Z]调试[31657]:阅读配置文件:/etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-04-21T15:17:01.436Z] DEBUG [31657]:刷新元数据..
[2015-04-21T15:17:02.352Z] DEBUG [31657]:刷新的环境元数据。
[2015-04-21T15:17:02.352Z] DEBUG [31657]:检索密钥的元数据:AWS :: ElasticBeanstalk :: Ext || _ContainerConfigFileContent || commands ..
[2015-04- 21T15:17:02.354Z] DEBUG [31657]:检索密钥的元数据:AWS :: ElasticBeanstalk :: Ext || _API || _Commands ..
[2015-04-21T15:17:02.355Z] INFO [ 31657]:找到启用的插件:[]。
[2015-04-21T15:17:02.355Z] DEBUG [31657]:加载CMD-TailLogs命令的定义。
[2015-04-21T15:17:02.355Z]信息[31657]:执行命令CMD-TailLogs活动...
[2015-04-21T15:17:02.355Z] DEBUG [31657] :设置环境变量..
[2015-04-21T15:17:02.355Z] INFO [31657]:运行AddonsBefore之前的命令CMD-TailLogs ...
[2015-04-21T15:17: 02.355Z] DEBUG [31657]:从阶段0到阶段1的命令CMD-TailLogs的运行阶段...
[2015-04-21T15:17:02.355Z] INFO [31657]:运行阶段0的命令CMD-TailLogs ...
[2015-04-21T15:17:02.356Z]调试[31657]:为阶段0加载1个动作。
[2015-04-21T15:17:02.356Z]信息[31657]:运行第1个操作:DockerPS ...
[2015-04-21T15:17:02.396Z] INFO [31657]:运行命令CMD-TailLogs的第1阶段
[2015-04-21T15:17:02.396Z] DEBUG [31657]:为第1阶段加载1个动作。
[2015-04-21T15:17:02.396Z] INFO [31657]:运行1/1动作:TailLogs ...
[2015-04-21T15:17:02.858Z] INFO [31657]:运行AddonsAfter命令CMD-TailLogs ...
[2015-04- 21T15:17:02.859Z] INFO [31657]:命令CMD-TailLogs成功!
[2015-04-21T15:17:02.860Z] INFO [31657]:命令处理器返回结果:
{status:SUCCESS,api_version:1.0,truncated :false,results:[{status:SUCCESS,msg:,returncode:0,events:[{msg:[Instance:i-c3213b14]成功完成拖尾7日志,severity:INFO,timestamp:1429629422860}]}}}
[2015-05-06T12:25:45.121Z] DEBUG [20429]:Reading配置文件:/etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-05-06T12:25:45.125Z] INFO [20429]:命令适用于此实例(i-c3213b14)..
[2015-05-06T12:25:45.125Z] DEBUG [20429]:检查接收的命令阶段是否有效..
[2015-05-06T12:25:45.125Z] INFO [20429 ]:没有stage_num命令。有效的阶段..
[2015-05-06T12:25:45.125Z] INFO [20429]:命令处理器应该执行命令。
[2015-05-06T12:25:45.125Z] DEBUG [20429]:存储当前阶段
[2015-05-06T12:25:45.125Z]调试[20429]:Stage_num不存在。不保存空位。返回..
[2015-05-06T12:25:45.126Z] INFO [20429]:执行命令:CMD-TailLogs ...
[2015-05-06T12:25:45.126Z]调试[20429]:阅读配置文件:/etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-05-06T12:25:45.126Z] DEBUG [20429]:刷新元数据
[2015-05-06T12:25:45.598Z] DEBUG [20429]:刷新的环境元数据。
[2015-05-06T12:25:45.599Z] DEBUG [20429]:检索密钥元数据:AWS :: ElasticBeanstalk :: Ext || _ContainerConfigFileContent || commands ..
[2015-05- 06T12:25:45.600Z] DEBUG [20429]:检索密钥的元数据:AWS :: ElasticBeanstalk :: Ext || _API || _Commands ..
[2015-05-06T12:25:45.601Z] INFO [ 20429]:找到启用的插件:[]。
[2015-05-06T12:25:45.601Z] DEBUG [20429]:命令CMD-TailLogs的加载定义。
[2015-05-06T12:25:45.601Z] INFO [20429]:执行命令CMD-TailLogs活动...
[2015-05-06T12:25:45.601Z] DEBUG [20429] :设置环境变量..
[2015-05-06T12:25:45.601Z] INFO [20429]:运行Addons在命令前CMD-TailLogs ...
[2015-05-06T12:25: 45.602Z] DEBUG [20429]:命令CMD-TailLogs从阶段0到阶段1的运行阶段...
[2015-05-06T12:25:45.602Z] INFO [20429]:命令的运行阶段0 CMD-TailLogs ...
[2015-05-06T12:25:45.602Z] DEBUG [20429]:为阶段0加载1个动作。
[2015-05-06T12:25:45.602Z] INFO [20429]:运行第1个操作:DockerPS ...
[2015-05-06T12:25:45.641Z] INFO [20429]:运行命令CMD-TailLogs的第1阶段
[2015-05-06T12:25:45.641Z] DEBUG [20429]:载入1个阶段1的动作。
[2015-05-06T12:25:45.641Z] INFO [20429]:运行1/1操作:TailLogs ...

我的Dockerrun.aws.json如下:

  {

AWSEBDockerrunVersion:1,
端口:[
{
ContainerPort:80
}
],
卷:{

}
}


解决方案

的错误 的答案:



,这个问题似乎与apache和ulimit错误有关。因为即使通常的错误/警告并不影响apache服务器的运行,它正在返回到Amazon的错误,而在创建容器和Docker容器似乎因为这样退出(我修复了一个相关的ServerName)





从Michel关于容器和前台进程的评论中,我将这行添加到Docker文件中:

  CMD / etc /init.d/apache2 start -D FOREGROUND 

Apache问题:



ServerName可以通过添加到.conf中来轻松修复:

  ServerName localhost 

和ulimit的问题:



ulimit问题:



Dockerfile的特权标志Docker容器(需要由于Apache错误ulimit)AWS


I am trying to deploy a Dockerfile and a Dockerrun.aws.json in Amazon EC2. I am able to successfully create the Docker container but after that, the instance is crashing. I dont know why the Docker container is quitting unexpectedly or how to fix it.

Log:

    Step 36 : RUN service apache2 stop && service apache2 start
       ---> Running in 1531cdba4bf1
    Stopping web server: apache2.
    [91m/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not  permitted)
    [0m[91mSetting ulimit failed. See README.Debian for more information.
    [0m[91mAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.32. Set the 'ServerName' directive globally to suppress this message
    [0mStarting web server: apache2.

   ---> 86403887587f
  Removing intermediate container 1531cdba4bf1
  Step 37 : EXPOSE 80
   ---> Running in 395114dad85b
   ---> 7350f1436bc2
  Removing intermediate container 395114dad85b
  Successfully built 7350f1436bc2
  Successfully built aws_beanstalk/staging-app
    [2015-04-21T15:16:46.558Z] INFO  [1799]  - [CMD-Startup/StartupStage0/AppDeployPreHook/04run.sh] : Starting activity...
    [2015-04-21T15:16:54.493Z] INFO  [1799]  - [CMD-Startup/StartupStage0/AppDeployPreHook/04run.sh] : Activity execution failed, because: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh
    d84f98c9e97a7287ca461510866d32adec0da73cbe5a7abcb8201490332a0f48
    Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Tue Apr 21 15:16:54 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)
        at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in `sh'
        from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in `sh'
        from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/executable.rb:63:in `execute!'
        from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in `block (2 levels) in run!'

Other information from the log:

Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Tue Apr 21 15:16:54 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)
    at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in `sh'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in `sh'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/executable.rb:63:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in `block (2 levels) in run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:28:in `block in run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:26:in `each'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:26:in `run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:215:in `block (3 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:209:in `block (2 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `each'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `each_with_index'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `block in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:204:in `exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:158:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:68:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:64:in `block (2 levels) in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:62:in `block in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:106:in `execute_command'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:60:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/bin/command-processor:46:in `<top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `load'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `<main>'



[2015-04-21T15:16:54.494Z] INFO  [1799]  - [CMD-Startup/StartupStage0/AppDeployPreHook/04run.sh] : Activity failed.
[2015-04-21T15:16:54.494Z] INFO  [1799]  - [CMD-Startup/StartupStage0/AppDeployPreHook] : Activity failed.
[2015-04-21T15:16:54.494Z] INFO  [1799]  - [CMD-Startup/StartupStage0] : Activity failed.
[2015-04-21T15:16:54.500Z] INFO  [1799]  - [CMD-Startup] : Completed activity. Result:
  Command CMD-Startup(stage 0) failed.
[2015-04-21T15:17:01.435Z] INFO  [31657] - [CMD-TailLogs] : Starting activity...
[2015-04-21T15:17:02.355Z] INFO  [31657] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2015-04-21T15:17:02.355Z] INFO  [31657] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2015-04-21T15:17:02.356Z] INFO  [31657] - [CMD-TailLogs/TailLogsDockerPS] : Starting activity...
[2015-04-21T15:17:02.356Z] INFO  [31657] - [CMD-TailLogs/TailLogsDockerPS/DockerPS] : Starting activity...
[2015-04-21T15:17:02.396Z] INFO  [31657] - [CMD-TailLogs/TailLogsDockerPS/DockerPS] : Completed activity.
[2015-04-21T15:17:02.396Z] INFO  [31657] - [CMD-TailLogs/TailLogsDockerPS] : Completed activity. Result:
  Command CMD-TailLogs stage 0 completed.
[2015-04-21T15:17:02.396Z] INFO  [31657] - [CMD-TailLogs/TailLogs] : Starting activity...
[2015-04-21T15:17:02.396Z] INFO  [31657] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
[2015-04-21T15:17:02.858Z] INFO  [31657] - [CMD-TailLogs/TailLogs/TailLogs] : Completed activity.
[2015-04-21T15:17:02.858Z] INFO  [31657] - [CMD-TailLogs/TailLogs] : Completed activity. Result:
  Command CMD-TailLogs stage 1 completed.
[2015-04-21T15:17:02.859Z] INFO  [31657] - [CMD-TailLogs/AddonsAfter] : Starting activity...
[2015-04-21T15:17:02.859Z] INFO  [31657] - [CMD-TailLogs/AddonsAfter] : Completed activity.
[2015-04-21T15:17:02.859Z] INFO  [31657] - [CMD-TailLogs] : Completed activity. Result:
  Command CMD-TailLogs succeeded.
[2015-05-06T12:25:45.126Z] INFO  [20429] - [CMD-TailLogs] : Starting activity...
[2015-05-06T12:25:45.601Z] INFO  [20429] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2015-05-06T12:25:45.602Z] INFO  [20429] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2015-05-06T12:25:45.602Z] INFO  [20429] - [CMD-TailLogs/TailLogsDockerPS] : Starting activity...
[2015-05-06T12:25:45.602Z] INFO  [20429] - [CMD-TailLogs/TailLogsDockerPS/DockerPS] : Starting activity...
[2015-05-06T12:25:45.640Z] INFO  [20429] - [CMD-TailLogs/TailLogsDockerPS/DockerPS] : Completed activity.
[2015-05-06T12:25:45.640Z] INFO  [20429] - [CMD-TailLogs/TailLogsDockerPS] : Completed activity. Result:
  Command CMD-TailLogs stage 0 completed.
[2015-05-06T12:25:45.641Z] INFO  [20429] - [CMD-TailLogs/TailLogs] : Starting activity...
[2015-05-06T12:25:45.641Z] INFO  [20429] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...



-------------------------------------
/var/log/docker-ps.log
-------------------------------------
'docker ps' ran at Wed May  6 12:25:45 UTC 2015: 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES



-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:26:in `run!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:215:in `block (3 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:209:in `block (2 levels) in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `each'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `each_with_index'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:207:in `block in exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:204:in `exec_stage'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:158:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command.rb:68:in `run'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:64:in `block (2 levels) in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:126:in `timeout_exec'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:110:in `block in create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `instance_eval'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:109:in `create'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:62:in `block in execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:106:in `execute_command'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/command-processor.rb:60:in `execute!'
    from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/bin/command-processor:46:in `<top (required)>'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `load'
    from /opt/elasticbeanstalk/lib/ruby/bin/command-processor:23:in `<main>'



[2015-04-21T15:16:54.500Z] ERROR [1799]  : Command CMD-Startup(stage 0) failed!
[2015-04-21T15:16:54.503Z] INFO  [1799]  : Command processor returning results: 
{"status":"FAILURE","api_version":"1.0","truncated":"false","results":[{"status":"FAILURE","msg":"[CMD-Startup/StartupStage0/AppDeployPreHook/04run.sh] command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh\nd84f98c9e97a7287ca461510866d32adec0da73cbe5a7abcb8201490332a0f48\nDocker container quit unexpectedly after launch: Docker container quit unexpectedly on Tue Apr 21 15:16:54 UTC 2015:. Check snapshot logs for details.","returncode":1,"events":[{"msg":"Successfully pulled chuseuiti/pynusci:latest","severity":"TRACE","timestamp":1429627195},{"msg":"Successfully built aws_beanstalk/staging-app","severity":"TRACE","timestamp":1429629406},{"msg":"Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Tue Apr 21 15:16:54 UTC 2015:. Check snapshot logs for details.","severity":"ERROR","timestamp":1429629414}]}]}
[2015-04-21T15:17:01.431Z] DEBUG [31657] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
   [2015-04-21T15:17:01.431Z] DEBUG [31657] : Checking if the command processor should execute.
[2015-04-21T15:17:01.435Z] DEBUG [31657] : Checking whether the command is applicable to instance (i-c3213b14)..
[2015-04-21T15:17:01.435Z] INFO  [31657] : Command is applicable to this instance (i-c3213b14)..
[2015-04-21T15:17:01.435Z] DEBUG [31657] : Checking if the received command stage is valid..
[2015-04-21T15:17:01.435Z] INFO  [31657] : No stage_num in command. Valid stage..
[2015-04-21T15:17:01.435Z] INFO  [31657] : Command processor should execute command.
[2015-04-21T15:17:01.435Z] DEBUG [31657] : Storing current stage..
[2015-04-21T15:17:01.435Z] DEBUG [31657] : Stage_num does not exist. Not saving null stage. Returning..
[2015-04-21T15:17:01.435Z] INFO  [31657] : Executing command: CMD-TailLogs...
[2015-04-21T15:17:01.436Z] DEBUG [31657] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-04-21T15:17:01.436Z] DEBUG [31657] : Refreshing metadata..
[2015-04-21T15:17:02.352Z] DEBUG [31657] : Refreshed environment metadata.
[2015-04-21T15:17:02.352Z] DEBUG [31657] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2015-04-21T15:17:02.354Z] DEBUG [31657] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2015-04-21T15:17:02.355Z] INFO  [31657] : Found enabled addons: [].
[2015-04-21T15:17:02.355Z] DEBUG [31657] : Loaded definition of Command CMD-TailLogs.
[2015-04-21T15:17:02.355Z] INFO  [31657] : Executing command CMD-TailLogs activities...
[2015-04-21T15:17:02.355Z] DEBUG [31657] : Setting environment variables..
[2015-04-21T15:17:02.355Z] INFO  [31657] : Running AddonsBefore for command CMD-TailLogs...
[2015-04-21T15:17:02.355Z] DEBUG [31657] : Running stages of Command CMD-TailLogs from stage 0 to stage 1...
[2015-04-21T15:17:02.355Z] INFO  [31657] : Running stage 0 of command CMD-TailLogs...
[2015-04-21T15:17:02.356Z] DEBUG [31657] : Loaded 1 actions for stage 0.
[2015-04-21T15:17:02.356Z] INFO  [31657] : Running 1 of 1 actions: DockerPS...
[2015-04-21T15:17:02.396Z] INFO  [31657] : Running stage 1 of command CMD-TailLogs...
[2015-04-21T15:17:02.396Z] DEBUG [31657] : Loaded 1 actions for stage 1.
[2015-04-21T15:17:02.396Z] INFO  [31657] : Running 1 of 1 actions: TailLogs...
[2015-04-21T15:17:02.858Z] INFO  [31657] : Running AddonsAfter for command CMD-TailLogs...
[2015-04-21T15:17:02.859Z] INFO  [31657] : Command CMD-TailLogs succeeded!
[2015-04-21T15:17:02.860Z] INFO  [31657] : Command processor returning results: 
{"status":"SUCCESS","api_version":"1.0","truncated":"false","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[{"msg":"[Instance: i-c3213b14] Successfully finished tailing 7 log(s)","severity":"INFO","timestamp":1429629422860}]}]}
[2015-05-06T12:25:45.121Z] DEBUG [20429] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
    [2015-05-06T12:25:45.125Z] INFO  [20429] : Command is applicable to this instance (i-c3213b14)..
[2015-05-06T12:25:45.125Z] DEBUG [20429] : Checking if the received command stage is valid..
[2015-05-06T12:25:45.125Z] INFO  [20429] : No stage_num in command. Valid stage..
[2015-05-06T12:25:45.125Z] INFO  [20429] : Command processor should execute command.
[2015-05-06T12:25:45.125Z] DEBUG [20429] : Storing current stage..
[2015-05-06T12:25:45.125Z] DEBUG [20429] : Stage_num does not exist. Not saving null stage. Returning..
[2015-05-06T12:25:45.126Z] INFO  [20429] : Executing command: CMD-TailLogs...
[2015-05-06T12:25:45.126Z] DEBUG [20429] : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2015-05-06T12:25:45.126Z] DEBUG [20429] : Refreshing metadata..
[2015-05-06T12:25:45.598Z] DEBUG [20429] : Refreshed environment metadata.
[2015-05-06T12:25:45.599Z] DEBUG [20429] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2015-05-06T12:25:45.600Z] DEBUG [20429] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2015-05-06T12:25:45.601Z] INFO  [20429] : Found enabled addons: [].
[2015-05-06T12:25:45.601Z] DEBUG [20429] : Loaded definition of Command CMD-TailLogs.
[2015-05-06T12:25:45.601Z] INFO  [20429] : Executing command CMD-TailLogs activities...
[2015-05-06T12:25:45.601Z] DEBUG [20429] : Setting environment variables..
[2015-05-06T12:25:45.601Z] INFO  [20429] : Running AddonsBefore for command CMD-TailLogs...
[2015-05-06T12:25:45.602Z] DEBUG [20429] : Running stages of Command CMD-TailLogs from stage 0 to stage 1...
[2015-05-06T12:25:45.602Z] INFO  [20429] : Running stage 0 of command CMD-TailLogs...
[2015-05-06T12:25:45.602Z] DEBUG [20429] : Loaded 1 actions for stage 0.
[2015-05-06T12:25:45.602Z] INFO  [20429] : Running 1 of 1 actions: DockerPS...
[2015-05-06T12:25:45.641Z] INFO  [20429] : Running stage 1 of command CMD-TailLogs...
[2015-05-06T12:25:45.641Z] DEBUG [20429] : Loaded 1 actions for stage 1.
[2015-05-06T12:25:45.641Z] INFO  [20429] : Running 1 of 1 actions: TailLogs...

My Dockerrun.aws.json is the following:

{

    "AWSEBDockerrunVersion": "1",
    "Ports": [
        {
            "ContainerPort":"80"
        }
    ],
    "Volumes":{

    }
}

解决方案

The answer to what is the error:

After following the comments, the problem seems to be related to apache and the ulimit error. Because even if normally that error/warning doesn't affect the running of the apache server, it is returning to Amazon the error while is creating the container and the Docker container seems to quit because of that.(I fixed the one related to the ServerName)

and the how:

From the comments of Michel regarding the container and the process in the foreground, I added this line to my Dockerfile:

CMD /etc/init.d/apache2 start -D FOREGROUND

The Apache issues:

The ServerName is easily fixed by adding to the .conf:

ServerName localhost

and the issue with ulimit:

A follow up of the ulimit issue:

Dockerfile privileged flag for Docker container (Needed because of Apache error ulimit ) AWS

这篇关于错误Docker在Amazon EC2中部署 - Docker容器意外退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆