Dockerrun.aws.json文件的私人dockerhub图像

我正在尝试将使用Docker构build的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文件在bucket myapp/config.json ,格式如下:

 { "https://index.docker.io/v1/": { "auth": "mylongauthtokenhere", "email": "me@myemail.com" } } 

这个设置工作,当我指向一个公共回购的"image": "myrepo/myapp:latest",行,但是当我尝试初始化与此configuration我得到错误: 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.' ERROR [Instance: i-913b2004] Command failed on instance. Return code: 1 Output: 'Failed to start ECS task after retrying 2 times.'

我也试过configurationconfig.json几种不同的方式,没有运气。 任何帮助,将不胜感激!

更新:OPfind了需要的特定angular色。 aws-elasticbeanstalk-ec2-role需要AmazonS3ReadOnlyAccess策略。

EB通过服务angular色来运行。 这些angular色需要获得适当的权限才能从S3获取证书文件: http : //docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles.html

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

Docker 1.7+login会生成如下的凭证文件config.json

 { "auths" : { "server" : { "auth" : "auth_token", "email" : "email" } } } 

Elastic Beanstalk以前只需要像这样的旧configuration对象格式:

  { "server" : { "auth" : "auth_token", "email" : "email" } } 

注意缺less的外部authentication块?

或者,也许这是另一回事,ElasticBeanstalk正在期待更新的格式,如果您在OP中注意到EB使用的是docker 1.9.1

你可以尝试编辑这个文件并重新上传到EB。 有关详细信息,请参阅此页面的底部: http : //docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-images-private