AWS Elastic beanstalk for Multicontainer Docker 配置中的版本错误
Version error in AWS Elastic beanstalk for Multicontainer Docker Configuration
尝试 link mysql 在 Elastic beanstalk 中使用 phabricator
dockerrun.aws.json 文件的帮助如下所示。
但它播报错误
[Instance: i-cdbaf100 Module: AWSEBAutoScalingGroup ConfigSet: null]
Command failed on instance.
Return code: 1
Output: Invalid Dockerrun.aws.json version, 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.
有人可以帮忙解决这个问题吗?
这是 Dockerfile.aws.json 文件:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
这是activity日志文件
[2015-05-09T08:12:17.546Z] INFO [24016] - [CMD-AppDeploy] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Completed activity.
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Starting activity...
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/configuration/.
Generate appsource url file at /opt/elasticbeanstalk/deploy/configuration/appsourceurl.
Generate container config file at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/appsource.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Starting activity...
[2015-05-09T08:12:18.332Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Starting activity...
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Starting activity...
[2015-05-09T08:12:18.646Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Starting activity...
[2015-05-09T08:12:18.647Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Starting activity...
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Starting activity...
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Completed activity.
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Starting activity...
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Completed activity. Result:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Starting activity...
[2015-05-09T08:12:19.124Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Completed activity. Result:
0||/
[2015-05-09T08:12:19.125Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Starting activity...
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity execution failed, because: Invalid Dockerrun.aws.json version, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: Invalid Dockerrun.aws.json version, abort deployment (Executor::NonZeroExitStatus)
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy] : Completed activity. Result:
Command CMD-AppDeploy failed.
OP javvaji kiran adds :
The service was not available for the location which I selected.
But service are available in other locations
原回答:
这取决于您收到的错误消息,但请注意 all values of a Dockerrun.aws.json
通常用双引号引起来。
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "janedoe/image",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "1234"
}
],
....
在自己添加双引号后检查错误是否仍然存在Dockerrun.aws.json
也就是说,确切的错误信息是:
Activity execution failed, because: Invalid Dockerrun.aws.json version
参见this source:
# 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
fi
所以试试 "AWSEBDockerrunVersion": "1",
此外,我在 Valid keys and values for the Dockerrun.aws.json
file 中没有看到 "links"。
创建环境时必须select 多容器类型。可能需要删除和创建新环境,因为目前无法从单一容器升级。
确保在配置下的仪表板上显示 "running Multi-container Docker"。
如果您遇到错误 "Invalid Dockerrun.aws.json version, abort deployment. ",也可能是您没有使用正确的解决方案堆栈。
在我的例子中,我使用的是单一容器解决方案堆栈,我本应该使用多容器解决方案堆栈。一旦我将我的环境配置为使用多容器解决方案堆栈,这个错误就消失了。
可在此处找到解决方案堆栈列表:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html#concepts.platforms.docker
尝试 link mysql 在 Elastic beanstalk 中使用 phabricator dockerrun.aws.json 文件的帮助如下所示。
但它播报错误
[Instance: i-cdbaf100 Module: AWSEBAutoScalingGroup ConfigSet: null]
Command failed on instance.
Return code: 1
Output: Invalid Dockerrun.aws.json version, 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.
有人可以帮忙解决这个问题吗?
这是 Dockerfile.aws.json 文件:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
这是activity日志文件
[2015-05-09T08:12:17.546Z] INFO [24016] - [CMD-AppDeploy] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Starting activity...
[2015-05-09T08:12:17.820Z] INFO [24016] - [CMD-AppDeploy/AddonsBefore] : Completed activity.
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Starting activity...
[2015-05-09T08:12:18.086Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteConfig] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/configuration/.
Generate appsource url file at /opt/elasticbeanstalk/deploy/configuration/appsourceurl.
Generate container config file at /opt/elasticbeanstalk/deploy/configuration/containerconfiguration.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Starting activity...
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp1] : Completed activity. Result:
Recreated directory /opt/elasticbeanstalk/deploy/appsource.
[2015-05-09T08:12:18.089Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Starting activity...
[2015-05-09T08:12:18.332Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Starting activity...
[2015-05-09T08:12:18.333Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Starting activity...
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2/Command 01downloadVersion] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.385Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2/Infra-WriteApplication2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/InfraWriteApp2] : Completed activity.
[2015-05-09T08:12:18.407Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Starting activity...
[2015-05-09T08:12:18.646Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Starting activity...
[2015-05-09T08:12:18.647Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] : Completed activity.
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Starting activity...
[2015-05-09T08:12:18.663Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Starting activity...
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/00clean_dir.sh] : Completed activity.
[2015-05-09T08:12:18.843Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Starting activity...
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/01unzip.sh] : Completed activity. Result:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "mysql-database",
"image": "mysql",
"essential": true,
"memory": 400
},
{
"name": "phabricator-only",
"image": "yesnault/docker-phabricator-alone",
"essential": true,
"memory": 400,
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
],
"links": [
"mysql-database"
]
}
]
}
[2015-05-09T08:12:19.121Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Starting activity...
[2015-05-09T08:12:19.124Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/02docker_db_check.sh] : Completed activity. Result:
0||/
[2015-05-09T08:12:19.125Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Starting activity...
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity execution failed, because: Invalid Dockerrun.aws.json version, abort deployment (ElasticBeanstalk::ExternalInvocationError)
caused by: Invalid Dockerrun.aws.json version, abort deployment (Executor::NonZeroExitStatus)
[2015-05-09T08:12:19.426Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/03build.sh] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy/AppDeployStage0] : Activity failed.
[2015-05-09T08:12:19.427Z] INFO [24016] - [CMD-AppDeploy] : Completed activity. Result:
Command CMD-AppDeploy failed.
OP javvaji kiran adds
The service was not available for the location which I selected.
But service are available in other locations
原回答:
这取决于您收到的错误消息,但请注意 all values of a Dockerrun.aws.json
通常用双引号引起来。
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "janedoe/image",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "1234"
}
],
....
在自己添加双引号后检查错误是否仍然存在Dockerrun.aws.json
也就是说,确切的错误信息是:
Activity execution failed, because: Invalid Dockerrun.aws.json version
参见this source:
# 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
fi
所以试试 "AWSEBDockerrunVersion": "1",
此外,我在 Valid keys and values for the Dockerrun.aws.json
file 中没有看到 "links"。
创建环境时必须select 多容器类型。可能需要删除和创建新环境,因为目前无法从单一容器升级。
确保在配置下的仪表板上显示 "running Multi-container Docker"。
如果您遇到错误 "Invalid Dockerrun.aws.json version, abort deployment. ",也可能是您没有使用正确的解决方案堆栈。
在我的例子中,我使用的是单一容器解决方案堆栈,我本应该使用多容器解决方案堆栈。一旦我将我的环境配置为使用多容器解决方案堆栈,这个错误就消失了。
可在此处找到解决方案堆栈列表: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html#concepts.platforms.docker