jvans
jvans

Reputation: 2915

Elastic Beanstalk with Docker deployment failure

I'm trying to deploy my application with docker and elastic beanstalk. My Dockerrun.aws.json file looks like

{
  "AWSEBDockerrunVersion": "1",
  "Image": {
    "Name": "jvans/maven_weekly",
    "Update": "true"
  },
  "Ports": [
    {
    "ContainerPort": "5000"
  }],
  "Volumes": [
    {
      "HostDirectory": "/Users/jamesvanneman/Code/maven_weekly/maven_weekly",
      "ContainerDirectory": "/maven_weekly"
  }
  ],
  "Logging": "/var/log/nginx"
}

I created this application with eb create and when I run eb deploy I get

Docker container quit unexpectedly after launch: Docker container quit 

unexpectedly on Mon Sep 21 01:15:12 UTC 2015:. Check snapshot logs for details. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/enact/00run.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

In var/log/eb-activity.log I see the following errors:

  Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Mon Sep 21 01:08:52 UTC 2015:. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError)
caused by: 83ea9b7f9a069eeb8351fef7aaedb8374f7dfe300a5e0aaeba0fe17600583175
[2015-09-21T01:08:52.205Z] INFO  [2246]  - [Application deployment/StartupStage1/AppDeployEnactHook/00run.sh] : Activity failed.

So it seems like there's a problem with a startup script. If i ssh into the container and try to run it manually I don't really get any extra help from error messages.

eb ssh

sudo /opt/elasticbeanstalk/hooks/appdeploy/enact/00run.sh

Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Mon Sep 21 01:34:52 UTC 2015:. Check snapshot logs for details.
Msg: Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Mon Sep 21 01:34:52 UTC 2015:. Check snapshot logs for details.

Are snapshot logs something different than what's in var/log/eb-activity.log? Any Idea what is going on/how I can debug this further?

Upvotes: 8

Views: 6860

Answers (4)

Chris Prince
Chris Prince

Reputation: 7584

In my case I did an eb ssh to connect into the ec2 instance and looked at my server logs. It was an application error. Nothing to do with AWS. Fixed it. Tried again and it's working!

Upvotes: 0

GG.
GG.

Reputation: 21884

In my case, unexpected-quit.log was empty and the other log files in /var/log/ didn't help.

So I found out why the container was crashing by manually running the image on the server.

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ nano Dockerfile # or clone the entire project
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo docker build -t test .
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo docker run --rm test
Exception in thread "main" …

I fixed that exception, redeployed a new version and now the container starts without issues.

Upvotes: 0

Resigned June 2023
Resigned June 2023

Reputation: 4957

You want to look at

/var/log/eb-docker/containers/eb-current-app/unexpected-quit.log

in the bundle downloaded by eb logs --all or using eb ssh. This log file will have the stdout and stderr of your application before it crashed.

Upvotes: 8

Tal
Tal

Reputation: 7997

Docker dumps are stored in the host box at /var/log/eb-docker/containers/.
Go there and you'll find the docker startup crash log that should indicate the root cause of your problem.

Upvotes: 12

Related Questions