AWS ElasticBeanstalk找不到Dockerfile

fre*_*lay 6 amazon-web-services docker

我有以下目录布局

./www/index.php
Dockerfile
apache-config.conf
Run Code Online (Sandbox Code Playgroud)

然后,我将文件压缩并上传到Elastic Beanstalk上,但收到以下错误消息:

[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.
Run Code Online (Sandbox Code Playgroud)

日志文件包含以下消息:

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)
Run Code Online (Sandbox Code Playgroud)

为什么我的dockerfile在这里没有被读取?我可以构建图像并在没有Elastic Beanstalk的情况下很好地运行它。

Siy*_*iyu 7

分享另一种可能性:

您正在测试eb,并且刚刚添加了Dockerfile。

根据文档

如果已安装git,则EB CLI会使用git archive命令从最新的git commit命令的内容中创建一个.zip文件。

这就是说,如果您的Dockerfile未提交,则不会被压缩,因此您的实例找不到它。


Dre*_*ang 5

在您的项目文件夹中压缩这些内容(进入您的项目文件夹并压缩所有内容),而不是压缩您的项目文件夹。

  • 这可能是最烦人的事情了。感谢您指出这一点。`cd /路径/到/项目;zip 存档.zip *;` (2认同)

Fra*_*ort 2

我也遇到过这个问题。看来Dockerrun.aws.json还需要一个文件。我相信这是因为应用程序中包含其他文件。如果您只有 aDockerfile而没有其他,则不需要。

这是文档:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html