Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS ElasticBeanstalk can't find Dockerfile

I have the following directory layout

./www/index.php
Dockerfile
apache-config.conf

I then zip up the file and upload it onto Elastic Beanstalk, but I get the following error message:

[Instance: i-572d1ae8] Command failed on instance. Return code: 1 Output: Dockerfile and Dockerrun.aws.json are both missing, abort deployment. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

The log file contains the following message:

AppDeployPreHook/01unzip.sh] : Completed activity. Result:
  Archive:  /opt/elasticbeanstalk/deploy/appsource/source_bundle
     creating: /var/app/current/DI_Test/
    inflating: /var/app/current/DI_Test/.DS_Store  
     creating: /var/app/current/__MACOSX/
     creating: /var/app/current/__MACOSX/DI_Test/
    inflating: /var/app/current/__MACOSX/DI_Test/._.DS_Store  
    inflating: /var/app/current/DI_Test/apache-config.conf  
    inflating: /var/app/current/DI_Test/Dockerfile  
    inflating: /var/app/current/__MACOSX/DI_Test/._Dockerfile  
     creating: /var/app/current/DI_Test/www/
    inflating: /var/app/current/DI_Test/www/.DS_Store  
     creating: /var/app/current/__MACOSX/DI_Test/www/
    inflating: /var/app/current/__MACOSX/DI_Test/www/._.DS_Store  
    inflating: /var/app/current/DI_Test/www/index.php  
[2015-10-29T14:01:33.279Z] INFO  [2865]  - [Application deployment/StartupStage0/AppDeployPreHook/03build.sh] : Starting activity...
[2015-10-29T14:01:33.579Z] INFO  [2865]  - [Application deployment/StartupStage0/AppDeployPreHook/03build.sh] : Activity execution failed, because: Dockerfile and Dockerrun.aws.json are both missing, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: Dockerfile and Dockerrun.aws.json are both missing, abort deployment (Executor::NonZeroExitStatus)

Why is my dockerfile not being read here? I can build the image and run it just fine without Elastic Beanstalk.

like image 860
freetoplay Avatar asked Oct 29 '15 14:10

freetoplay


5 Answers

Sharing another possibility:

You were testing eb and you've just added your Dockerfile.

According to the doc

If git is installed, EB CLI uses the git archive command to create a .zip file from the contents of the most recent git commit command.

That's saying if your Dockerfile is not committed, it won't be zipped in therefore your instance can't find it.

like image 64
Siyu Avatar answered Nov 19 '22 04:11

Siyu


Compress those stuff within your project folder(go into your project folder and zip everything), instead of zipping your project folder.

like image 36
Drew Yang Avatar answered Nov 19 '22 05:11

Drew Yang


In my case there was a spelling mistake in Dockerfile name i.e DockerFile. Elastic Beanstalk is case sensitive.

like image 32
Swapnil Kakde Avatar answered Nov 16 '22 00:11

Swapnil Kakde


I've come across this issue as well. It seems a Dockerrun.aws.json file is required as well. I believe that is because other files are included in the app. If you had only a Dockerfile and nothing else, it wouldn't be required.

Here's the documentation: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html

like image 2
Francis Eytan Dortort Avatar answered Nov 19 '22 06:11

Francis Eytan Dortort


You don't need to include parent directory in zip file. Suppose you want to zip ./www/index.php ,Dockerfile and apache-config.conf then,

zip dist.zip Dockerfile ./www/index.php apache-config.conf

The upload dist.zip. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deployment.source.html

like image 4
Rajith Delantha Avatar answered Nov 19 '22 06:11

Rajith Delantha