Error Docker deployment in Amazon EC2 - Docker con

2019-06-24 08:45发布

问题:

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":{

    }
}

回答1:

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