我正在為我的應用程式創建CodePipeline,但AWS ElasticBeanstalk的部署程序失敗并出現以下錯誤:
實體部署:源包中缺少“Dockerfile”和“Dockerrun.aws.json”。至少包括其中之一。部署失敗。
完整的訊息錯誤是:
部署已完成,但有錯誤:在中止部署期間,某些實體可能已部署了新的應用程式版本。為確保所有實體都運行相同的版本,請重新部署適當的應用程式版本。部署應用程式失敗。實體 ID 'i-0b8823de2e7376c81' 上的命令執行失敗。中止操作。[實體:i-0b8823de2e7376c81] 命令在實體上失敗。回傳碼:1 輸出:引擎執行遇到錯誤。實體部署失敗。有關詳細資訊,請參閱“eb-engine.log”。實體部署:源包中缺少“Dockerfile”和“Dockerrun.aws.json”。至少包括其中之一。部署失敗。
我的環境有 3 個容器,為了部署這個環境,我使用docker-compose-qa.yml檔案,在AWS CodeBuild 中,我將此檔案定義為工件,如下所示:
artifacts:
files:
- 'docker-compose-qa.yml'
該泊塢窗,撰寫-qa.yml:
version: '3.8'
services:
sitr-api:
image: ${{ secrets.SITR_API_QA_URI_DOCKER_IMG }}
container_name: sitr-api-qa
environment:
- ASPNETCORE_ENVIRONMENT=QA
ports:
- "9901:80"
volumes:
- "./Host-Logs:/app/App_Data/Logs"
sitr-app:
image: ${{ secrets.SITR_APP_QA_URI_DOCKER_IMG }}
container_name: sitr-app-qa
ports:
- "9902:80"
sitr-nginx:
image: ${{ secrets.SITR_NGINX_QA_URI_DOCKER_IMG }}
container_name: sitr-nginx-qa
depends_on:
- sitr-app
- sitr-api
ports:
- "80:80"
eb-engine.log 錯誤:
2021/10/26 22:07:27.977004 [ERROR] 執行命令 [app-deploy] - [Docker 特定構建應用程式] 時出錯。停止運行命令。錯誤:Dockerfile 和 Dockerrun.aws.json 都丟失,中止部署
2021/10/26 22:07:27.977008 [INFO] Executing cleanup logic 2021/10/26 22:07:27.977098 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: Both 'Dockerfile' and 'Dockerrun.aws.json' are missing in your source bundle. Include at least one of them. The deployment failed.","timestamp":1635286047,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1635286047,"severity":"ERROR"}]}]}
My CodeBuild just build a dotnet application, angular aplication and build the 3 docker containers for both application and nginx.
If I run my CodeBuild manually and then choose my docker-compose-qa.yml file in AWS EB, the publication is successfully applied.
I checked AWS S3 Bucket and the file is being zipped to a folder for the artifact.
The question is:
Why is Pipeline complaining about the non-existence of 'Dockerfile' and 'Dockerrun.aws.json' files? How can I specify it to use the docker-compose-qa.yml file?
uj5u.com熱心網友回復:
根據評論。
該問題是由錯誤的檔案名引起的。它應該被稱為docker-compose.yml,而不是docker-compose-qa.yml。重命名檔案解決了這個問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/338570.html
標籤:amazon-web-services docker docker-compose amazon-elastic-beanstalk aws-codepipel
