Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Elastic Beanstalk Docker run failures?

I'm new to EB and AWS, and my docker images build fine but fail to run on Elastic Beanstalk. My suspicion is that they are not connecting to the database correctly, however, I'm not getting anything useful when I run "eb logs" from the commandline. Here are the errors:

{
  "status": "FAILURE",
  "api_version": "1.0",
  "results": [
    {
      "status": "FAILURE",
      "msg": "(TRUNCATED)...rrun.aws.json: No such file or directory
        73927c49adff622a1a229d9369bdd80674d96d20f3eb99a9cdea786f4411a368
        Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Wed May 20 17:15:02 UTC 2015:.
        Check snapshot logs for details.
        Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh failed.
        For more detail, check /var/log/eb-activity.log using console or EB CLI",
      "returncode": 1,
      "events": [
        {
          "msg": "Successfully pulled node:0.12.2-slim",
          "severity": "TRACE",
          "timestamp": 1432142064
        },
        {
          "msg": "Successfully built aws_beanstalk/staging-app",
          "severity": "TRACE",
          "timestamp": 1432142094
        },
        {
          "msg": "Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Wed May 20 17:15:02 UTC 2015:. Check snapshot logs for details.",
          "severity": "ERROR",
          "timestamp": 1432142102
        }
      ]
    }
  ],
  "truncated": "true"
}

And after the build completes:

[2015-05-20T17:15:02.694Z] INFO  [8603]  - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] : Activity execution failed, because: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  73927c49adff622a1a229d9369bdd80674d96d20f3eb99a9cdea786f4411a368
  Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Wed May 20 17:15:02 UTC 2015:. Check snapshot logs for details. (ElasticBeanstalk::ExternalInvocationError)
caused by: cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  cat: /var/app/current/Dockerrun.aws.json: No such file or directory
  73927c49adff622a1a229d9369bdd80674d96d20f3eb99a9cdea786f4411a368
  Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Wed May 20 17:15:02 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)

The docker containers work locally, so what else can I do to figure out what's going wrong? I keep hearing about "snapshot logs" but where do I check these snapshot logs? Are they the output of what I'm already running "eb logs"?

like image 723
chum of chance Avatar asked May 20 '15 19:05

chum of chance


People also ask

How do I debug a Docker run?

To debug the docker daemon, we need to start the daemon manually. Manually starting the daemon allows us to pass arguments to the dockerd command and enable the debug mode. NOTE: Depending on your system configuration, you might need to launch the Docker daemon as root.

How do I run a Docker image in Elastic Beanstalk?

Use the Elastic Beanstalk CLI (EB CLI) to configure your local repository for deployment to Elastic Beanstalk. Set your application's Dockerfile at the root of the directory. (Optional) Use the eb local run command to build and run your container locally. To learn more about the eb local command, see eb local.

Does Elastic Beanstalk support Docker?

Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment.

Can you debug a Docker container?

The Docker extension currently supports debugging Node. js, Python, and . NET applications within Docker containers.


1 Answers

I had this issue for a day or two. I managed to see the logs by going AWS Console > Elastic Beanstalk > Environment > ${YOUR_APPLICATION_ENV}

On the left pane;

Log > Request Logs > Download > Open in any text editor.

/var/log/eb-docker/containers/eb-current-app/

Follow the path and you will see the what causing the error and can fix it.

like image 51
Eren Yatkin Avatar answered Oct 13 '22 21:10

Eren Yatkin