amazon-web-services - AWS Elastic Beanstalk 'CannotPullContainerError' 用于私有 Docker 映像(多实例)
问题描述
我有一个单实例弹性 beanstalk 环境,它运行一个 docker 镜像,该镜像在 Dockerhub 上作为私有镜像托管。这工作正常。我正在尝试创建一个新的多容器环境,它运行完全相同的图像(加上另一个,不在我的代码示例中)。在多容器环境中,我无法让弹性 beanstalk 启动我的 docker 映像,我收到以下错误:
ECS task stopped due to: Task failed to start. (img1_name: img2_name: CannotPullContainerError: Error response from daemon: pull access denied for user/repo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied)
这是我的单实例环境的 dockerrun:
{
"AWSEBDockerrunVersion": "1",
"Authentication": {
"Bucket": "my_bucket",
"Key": ".dockercfg"
},
"Image": {
"Name": "user/repo:tag",
"Update": "true"
},
"Ports": [
{
"ContainerPort": 5000,
"HostPort": 443
}
],
"Logging": "/var/log/nginx"
}
这是 .dockerfcg 文件:
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "my_token"
}
}
}
同样,上述工作正常。
我的多实例 dockerrun 文件如下:
{
"AWSEBDockerrunVersion": "2",
"authentication": {
"bucket": "my_bucket",
"key": ".dockercfg"
},
"containerDefinitions": [
{
"name": "img_name",
"image": "user/repo:tag",
"essential": true,
"memoryReservation": 128,
"portMappings": [
{
"hostPort": 80,
"containerPort": 5000
}
]
}
],
"Logging": "/var/log/nginx"
}
我已经 ssh-ed 到我的 elastic-beanstalk 实例并运行以下命令以检查它是否能够从我的 s3 存储桶访问 .dockercfg:
aws s3api get-object --bucket mybucket --key dockercfg dockercfg
我还尝试了 .dockercfg 文件的各种不同格式,包括...
{
"https://index.docker.io/v1/": {
"auth": "zq212MzEXAMPLE7o6T25Dk0i",
"email": "email@example.com"
}
}
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "zq212MzEXAMPLE7o6T25Dk0i"
}
}
}
我为此烦恼不已,我在这里和 AWS 论坛上发现了一些类似的主题,但似乎没有什么能解决我的问题。非常感谢任何帮助。
解决方案
推荐阅读
- java - 将度数符号 ( ° ) 从 XML 传递到 java
- ios - 在 UIImageView 中剪辑的圆角
- vba - 将单元格引用用于自定形线
- shell - shell find 命令:混合排除目录和包含特定目录
- sql - 通过通知顺序执行 SQL Server 存储过程
- javascript - 删除后反应动态行输入值仍然存在
- mongodb - 使用 findOne() 或 findOneAndRemove() 等 mongoose 方法的集合遍历顺序
- java - ClassNotFoundException:在路径上找不到类“clipper”:DexPathList - Android Studio
- javascript - 将表单值附加到操作 url - 动态
- coq - CoqIde 关于自动战术的奇怪信息