执行“eb本地运行”时出现“configurationregistry无效”错误
我认为这是一个很容易解决的问题,但我似乎无法解决它!
我花了很多时间在Google / SO上寻找任何线索,但没有解决。
执行eb本地运行时,出现registry错误的无效configuration
{17-05-17 10:22}[2.3.1]me:~/Repositories/xxx@master✗✗✗✗✗✗ chris% eb local run ERROR: InvalidConfigFile :: Invalid configuration for registry 12345678.dkr.ecr.eu-west-1.amazonaws.com {17-05-17 10:22}[2.3.1]me:~/Repositories/xxx@master✗✗✗✗✗✗ chris%
我的Dockerrun.aws.json中的图像行如下所示:
{ "AWSEBDockerrunVersion": 2, "volumes": [ { "name": "frontend", "host": { "sourcePath": "/var/app/current/frontend" } }, { "name": "backend", "host": { "sourcePath": "/var/app/current/backend" } }, { "name": "nginx-proxy-conf", "host": { "sourcePath": "/var/app/current/config/nginx" } }, { "name": "nginx-proxy-content", "host": { "sourcePath": "/var/app/current/content/" } }, { "name": "nginx-proxy-ssl", "host": { "sourcePath": "/var/app/current/config/ssl" } } ], "containerDefinitions": [ { "name": "backend", "image": "123456.dkr.ecr.eu-west-1.amazonaws.com/backend:latest", "Update": "true", "essential": true, "memory": 512, "mountPoints": [ { "containerPath": "/app/backend", "sourceVolume": "backend" } ], "portMappings": [ { "containerPort": 4000, "hostPort": 4000 } ], "environment": [ { "name": "PORT", "value": "4000" }, { "name": "MIX_ENV", "value": "dev" }, { "name": "PG_PASSWORD", "value": "xxsaxaax" }, { "name": "PG_USERNAME", "value": " }, { "name": "PG_HOST", "value": "123456.dsadsau89das.eu-west-1.rds.amazonaws.com" }, { "name": "FE_URL", "value": "http://develop1.com" } ] }, { "name": "frontend", "image": "123456.dkr.ecr.eu-west-1.amazonaws.com/frontend:latest", "Update": "true", "essential": true, "memory": 512, "links": [ "backend" ], "command": [ "npm", "run", "production" ], "mountPoints": [ { "containerPath": "/app/frontend", "sourceVolume": "frontend" } ], "portMappings": [ { "containerPort": 3000, "hostPort": 3000 } ], "environment": [ { "name": "REDIS_HOST", "value": "www.eample.com" } ] }, { "name": "nginx-proxy", "image": "nginx", "essential": true, "memory": 128, "portMappings": [ { "hostPort": 80, "containerPort": 3000 } ], "links": [ "backend", "frontend" ], "mountPoints": [ { "sourceVolume": "nginx-proxy-content", "containerPath": "/var/www/html" }, { "sourceVolume": "awseb-logs-nginx-proxy", "containerPath": "/var/log/nginx" }, { "sourceVolume": "nginx-proxy-conf", "containerPath": "/etc/nginx/conf.d", "readOnly": true }, { "sourceVolume": "nginx-proxy-ssl", "containerPath": "/etc/nginx/ssl", "readOnly": true } ] } ], "family": "" }
看起来你有一个破碎的dockerregistryauthenticationconfiguration文件。 在你家里,这个文件~/.docker/config.json
应该是这样的:
{ "auths": { "https://1234567890.dkr.ecr.us-east-1.amazonaws.com": { "auth": "xxxxxx" } } }
这是用命令docker login
生成(与aws ecr get-login
)
检查一下。 我这样说是因为你在这里input一个例外:
for registry, entry in six.iteritems(entries): if not isinstance(entry, dict): # (...) if raise_on_error: raise errors.InvalidConfigFile( 'Invalid configuration for registry {0}'.format(registry) ) return {}
这是由于当前版本的awsebcli
工具中过时的依赖关系造成的。 他们固定版本“docker-py(> = 1.1.0,<= 1.7.2)”,不支持较新的证书助手格式。 最新版本的docker-py
是第一个正确支持最新的凭证助手格式,直到AWS EB CLI开发人员更新docker-py
才能使用2.4.0( https://github.com/docker/docker-py/发布/标签/ 2.4.0 )这将保持破碎。
首先是它不是有效的json,PG_USERNAME字段没有封闭的引号。
{ "name": "PG_USERNAME", "value": " },
应该
{ "name": "PG_USERNAME", "value": "" },
接下来要检查的是你的Beanstalk实例configuration文件是否可以访问ecrregistry。
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-instanceprofile.html
指定要从中构buildDocker容器的现有Docker存储库中的Docker基础映像。 在Docker Hub上以/格式指定Name键的值,或者//为其他站点指定。
当您在Dockerrun.aws.json文件中指定图像时,Elastic Beanstalk环境中的每个实例都将运行docker pull并运行该图像。 可以包含更新密钥。 默认值为“true”,并指示Elastic Beanstalk检查存储库,将任何更新提取到图像,并覆盖任何caching的图像。
使用Dockerfile时,请勿在Dockerrun.aws.json文件中指定Image键。 .Elastic Beanstalk将始终构build并使用Dockerfile中描述的映像。
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html
testing以确保您可以访问Elasticbeanstalk之外的ecr。
$ docker pull aws_account_id.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest latest: Pulling from amazonlinux 8e3fa21c4cc4: Pull complete Digest: sha256:59895a93ba4345e238926c0f4f4a3969b1ec5aa0a291a182816a4630c62df769 Status: Downloaded newer image for aws_account_id.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latest
http://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-pull-ecr-image.html
- Elastic Beanstalk上的Docker连接到上游时connect()失败(111:连接被拒绝)
- 自助托pipe的kibana 5.1.1在连接到AWS Elasticsearch 5.1.1后显示空白页面
- Elastic Beanstalk和Docker – EB CLI在Mac上不起作用! BUG
- 具有Docker和EBS卷的EC2,在初始化期间在容器内安装EBS卷
- 如何从特定的git分支推送到AWS EC2服务容器(即“分段”)
- 无法连接到docker集装箱
- 通过GitLabpipe道将Docker容器部署到EC2容器服务时出错
- 通过awsebcli在Elastic Beanstalk(多容器Docker)中使用自定义的AMI
- 环境特定的Docker堆栈部署设置