无法通过S3向Elastic Beanstalk中的Docker进行身份validation
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html#docker-singlecontainer-dockerrun-privaterepo
按照这里的说明从Elastic Beanstalk连接到私有Docker Hub容器,但它固执地拒绝工作。 这似乎是在Docker 1.12中调用docker login
,生成的文件没有email属性,但听起来像aws期望的那样,所以我创build了一个名为dockercfg.json的文件,如下所示:
{ "https://index.docker.io/v1/": { "auth": "Y2...Fz", "email": "c...n@gmail.com" } }
我的Dockerrun.aws.json文件的相关部分如下所示:
"Authentication": { "Bucket": "elasticbeanstalk-us-west-2-9...4", "Key": "dockercfg.json" },
我已经将file upload到S3存储桶的根目录。 为什么我仍然得到说Error: image c...6/w...t:23 not found. Check snapshot logs for details.
Error: image c...6/w...t:23 not found. Check snapshot logs for details.
我确定这个名字是正确的,如果它是一个公共存储库,这个名字就可以工作。 完整的错误在下面。 我从GitHub与Circle CI部署,如果有所作为,很乐意提供任何其他所需的信息。
INFO: Deploying new version to instance(s). WARN: Failed to pull Docker image c...6/w...t:23, retrying... ERROR: Failed to pull Docker image c...6/w...t:23: Pulling repository docker.io/c...6/w...t Error: image c...6/w...t:23 not found. Check snapshot logs for details. ERROR: [Instance: i-06b66f5121d8d23c3] Command failed on instance. Return code: 1 Output: (TRUNCATED)...b-project Error: image c...6/w...t:23 not found Failed to pull Docker image c...6/w...t:23: Pulling repository docker.io/c...6/w...t Error: image c...6/w...t:23 not found. Check snapshot logs for details. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03build.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. ERROR: Unsuccessful command execution on instance id(s) 'i-06b66f5121d8d23c3'. Aborting the operation. ERROR: Failed to deploy application. ERROR: Failed to deploy application.
编辑:这是完整的Dockerrun文件。 请注意,%BUILD_NUM%只是一个整数,我可以validation工程。
{ "AWSEBDockerrunVersion": "1", "Authentication": { "Bucket": "elasticbeanstalk-us-west-2-9...4", "Key": "dockercfg.json" }, "Image": { "Name": "c...6/w...t:%BUILD_NUM%", "Update": "true" }, "Ports": [ { "ContainerPort": "8080" } ] }
编辑:另外,我已经validation了这个工作,如果我把这个Docker Hub容器公开。
好的,我们来做吧。
看着同一个文档页面,
使用Docker版本1.6.2及更低版本,docker login命令将使用以下格式在〜/ .dockercfg中创build身份validation文件:
{ "server" : { "auth" : "auth_token", "email" : "email" } }
你已经看到了这个部分。 请逐一检查下面的案例;
1)你是否在同一地区托pipeS3存储桶?
Amazon S3存储桶必须与使用它的环境位于同一区域。 Elastic Beanstalk无法从其他地区托pipe的Amazon S3存储桶中下载文件。
2)你检查了所需的权限?
将s3:GetObject操作的权限授予实例configuration文件中的IAMangular色。 有关详细信息,请参阅pipe理Elastic Beanstalk实例configuration文件 。
3)你的configuration文件中是否有你的S3 bucket信息? (我想你也是这样)
将Amazon S3存储桶信息包含在
Dockerrun.aws.json
文件的Authentication
(v1)或authentication
(v2)参数中。
无法看到您的权限或您的env地区,所以请仔细检查这些。 如果这不起作用,我会尽可能升级到Docker 1.7+,并使用相应的~/.docker/config.json
风格。