gpt4 book ai didi

amazon-web-services - 用于私有(private) dockerhub 镜像的 Dockerrun.aws.json 文件

转载 作者:行者123 更新时间:2023-12-02 18:32:18 29 4
gpt4 key购买 nike

我正在尝试将使用 Docker 构建的 rails 应用程序部署到 Elastic Beanstalk 的多容器服务。我的 Dockerrun.aws.json 目前看起来像:

{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "myapp",
"host": {
"sourcePath": "/var/app/current"
}
},
{
"name": "myapp-redis",
"host": {
"sourcePath": "/var/app/current/myapp-redis"
}
},
{
"name": "myapp-postgres",
"host": {
"sourcePath": "/var/app/current/myapp-postgres"
}
}
],
"authentication": {
"bucket": "myapp",
"key": "config.json"
},
"containerDefinitions": [
{
"name": "redis",
"image": "redis:3.0.5",
"environment": [
{
"name": "Container",
"value": "redis"
}
],
"portMappings": [
{
"hostPort": 6379,
"containerPort": 6379
}
],
"essential": true,
"memory": 128,
"mountPoints": [
{
"sourceVolume": "myapp-redis",
"containerPath": "/var/lib/redis/data",
"readOnly": false
}
]
},
{
"name": "postgres",
"image": "postgres:9.4.5",
"environment": [
{
"name": "Container",
"value": "postgres"
}
],
"portMappings": [
{
"hostPort": 5432,
"containerPort": 5432
}
],
"essential": true,
"memory": 128,
"mountPoints": [
{
"sourceVolume": "myapp-postgres",
"containerPath": "/var/lib/postgresql/data",
"readOnly": false
}
]
},
{
"name": "myapp",
"image": "myrepo/myapp:latest",
"environment": [
{
"name": "Container",
"value": "myapp"
}
],
"essential": true,
"memory": 128,
"mountPoints": [
{
"sourceVolume": "myapp",
"containerPath": "/myapp",
"readOnly": false
}
]
}
]
}

我的 config.json文件位于存储桶 myapp/config.json格式如下:
{
"https://index.docker.io/v1/": {
"auth": "mylongauthtokenhere",
"email": "me@myemail.com"
}
}

当我指向 "image": "myrepo/myapp:latest", 的公共(public)存储库时,此设置有效。行,但是当我尝试使用此配置进行初始化时出现错误: err="Error: image myrepo/myapp:latest not found"ERROR [Instance: i-913b2004] Command failed on instance. Return code: 1 Output: 'Failed to start ECS task after retrying 2 times.'
我也尝试过用几种不同的方式配置 config.json,但没有成功。对此的任何帮助将不胜感激!

最佳答案

UPDATE: the OP found the specific role that was needed. The aws-elasticbeanstalk-ec2-role needed the AmazonS3ReadOnlyAccess policy.



EB 通过服务角色运行。这些角色需要被授予适当的权限才能出去并从 S3 获取凭证文件: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles.html

另外,我猜你在本地使用 Docker 1.7 或更高版本。

Docker 1.7+ 登录生成凭证文件 config.json像这样:
{
"auths" :
{
"server" :
{
"auth" : "auth_token",
"email" : "email"
}
}
}

Elastic Beanstalk 过去只需要像这样的旧配置对象格式:
 {
"server" :
{
"auth" : "auth_token",
"email" : "email"
}
}

注意到缺少的外部身份验证 block 了吗?

或者,如果您在 OP EB 中指出使用 docker 1.9.1,则可能是相反的情况,并且 ElasticBeanstalk 期待更新的格式

您可以尝试编辑此文件并重新上传到 EB。详情见本页底部: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-images-private

关于amazon-web-services - 用于私有(private) dockerhub 镜像的 Dockerrun.aws.json 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38212778/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com