4

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

    }
}
chuseuiti
  • 783
  • 1
  • 9
  • 32
  • Can you use `eb logs` and check /var/log/directory-hooks-executor.log to see more about the error? – Michael May 06 '15 at 22:13
  • After downloading the log, I dont find directory-hooks-executor.log. I found the following log files: cfn-hup.log, cfn-init.log, cnf-init-cmd.log, cloud-init.log, cloud-init-output.log, docker-events.log, eb-activity.log, eb-cfn-init.log,eb-cfn-init-call.log, eb-commadprocessor.log, eb-publish-logs.log, eb-tools.log, eb-versión-deployment.log and unexpected-quit.log. Also I updated more lines of the log in the question in case it helps. – chuseuiti May 07 '15 at 01:28
  • from your logs, it seems like your docker container is quitting, when your apache builds it has issues, can you start this container manually? what happens when you start it interactively and try to start apache? – Michael May 07 '15 at 02:38
  • I created the container by hand just following the steps from the dockerfile and It didnt crash. Regarding apache, it is working correctly and I can connect from outside to the instance. However it is not able to show the web App because of some other issues(that I have already identified), but apache is giving the error 500 (something expected). That is why I dont understand why with the automatic versión is quitting the instance. – chuseuiti May 08 '15 at 04:32
  • 1
    A container must have a running process in the foreground, without seeing the dockerfile, I assume it is apache, if apache cannot start, the container will exit. – Michael May 08 '15 at 07:44
  • Then I have another question, if I just want to automatically create the container but the container is not going to run anything in the foreground, is Amazon going to give an error while is creating the instance and is going to quit unexpectedly the docker container?(I erased the other comment because it didn't affect to your answer and It was confusing) – chuseuiti May 08 '15 at 15:22
  • A container must have a foreground program otherwise it will exit. You might want to look at https://docs.docker.com/introduction/understanding-docker/ – Michael May 08 '15 at 15:45
  • Maybe the question is too specific of my stack, please let me know if I should erase it. – chuseuiti May 09 '15 at 17:54
  • I gave you the answer, your apache is not starting, that is what needs to be fixed in order to have the container work properly. – Michael May 09 '15 at 18:14

1 Answers1

6

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

Community
  • 1
  • 1
chuseuiti
  • 783
  • 1
  • 9
  • 32