I was trying to deploy a multi-container environment on Elastic beanstalk (infrastructure bit was created long time ago using terraform) and during the deployment I've did get a following error:
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: Invalid Dockerrun.aws.json version, abort deployment
ERROR: [Instance: i-02c010ce9c14fb76c,i-023ce567e138904ea] Command failed on instance. Return code: 1 <b>Output: Invalid Dockerrun.aws.json version</b>, 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.
So I was struggling to define Dockerrun.aws.json in a right version following AWS docs.
I can see in pre/03build.sh script that you have a Dockerrun.json version check:
# Dockerrun.aws.json verson checking
# right now only one valid version "1"
if [ -f Dockerrun.aws.json ]; then
[ "`cat Dockerrun.aws.json | jq -r .AWSEBDockerrunVersion`" = "1" ] || error_exit "Invalid Dockerrun.aws.json version, abort deployment" 1
After several approaches to solve this issue, I've decided to check how the infrastructure was created and I've found that the elastic beanstalk environment was created for single container
!
So I've verified solution stacks for both single and multi container here: Elastic Beanstalk Supported Platforms
Solution was quite simple and I just had to change the version and solution stack from 64bit Amazon Linux 2017.03 v2.7.0 running Docker 17.03.1-ce
to 64bit Amazon Linux 2017.03 v2.7.1 running Multi-container Docker 17.03.1-ce (Generic)
.
After that deployment completed without any issues.
I guess Amazon should make it more user friendly as for naming the solution stack, its not clear that Amazon Linux running Docker
is a single container solution stack :)