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

时间:2016-07-05 21:09:38

标签: amazon-web-services docker elastic-beanstalk

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

0:000> .sympath+ C:\Test\56RC\Release
DBGHELP: Symbol Search Path: cache*;SRV*https://msdl.microsoft.com/download/symbols;c:\test\56rc\release
DBGHELP: Symbol Search Path: cache*;SRV*https://msdl.microsoft.com/download/symbols;c:\test\56rc\release
Symbol search path is: srv*;C:\Test\56RC\Release
Expanded Symbol search path is: cache*;SRV*https://msdl.microsoft.com/download/symbols;c:\test\56rc\release

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
OK                                             C:\Test\56RC\Release

我的{ "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",err="Error: image myrepo/myapp:latest not found"

我也试过用几种不同的方式配置config.json而没有运气。任何有关这方面的帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

  

更新:OP找到了所需的特定角色。该   key需要AmazonS3ReadOnlyAccess   政策。

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

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

Docker 1.7+登录会生成一个凭据文件aws-elasticbeanstalk-ec2-role,如下所示:

config.json

Elastic Beanstalk曾经只想要这样的旧配置对象格式:

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

注意缺少外部auth块?

或许反过来说,如果您在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