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.
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.
Compress those stuff within your project folder(go into your project folder and zip everything), instead of zipping your project folder.
In my case there was a spelling mistake in Dockerfile
name i.e DockerFile. Elastic Beanstalk is case sensitive.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With