【问题标题】:Pulling Image from Public Docker Hub to AWS Elastic Beanstalk Multiple Container将图像从公共 Docker Hub 拉取到 AWS Elastic Beanstalk 多个容器
【发布时间】:2020-06-17 04:15:21
【问题描述】:

我试图让多个容器在同一个 Elastic Beanstalk 实例上运行,其中一个 NodeJS 服务器侦听来自 ReactJS/Webpack 客户端的 API——每个容器都在各自的容器中运行。我正在使用一个 Dockerrun.aws.json 文件,该文件从我的公共 docker 存储库中提取图像。当我将 Dockerrun.aws.json 部署到 Elastic Beanstalk 时,它表示该实例正在 AWS 控制台内运行。但是,我无法访问 URL,并且从日志中收到以下错误:

mv: cannot stat ‘/etc/init/eb-ecs.conf.disabled’: No such file or directory
  Error response from daemon: No such image: 6011d33fc722:latest

我的问题是如何让 Elastic Beanstalk 拉取并在我的 EC2 实例上运行容器?我已经尝试将图像放入 Elastic Container Repositories 中,结果相似。

{
    "AWSEBDockerrunVersion": 2,
    "containerDefinitions": [
        {
            "name": "dev-server",
            "image": "sjryall/dev-server-v2:latest",
            "memory": 128,
            "portMappings": [
                {
                    "hostPort": 8000,
                    "containerPort": 8000
                }
            ],
            "links": [
                "dev-client"
            ]
        },
        {
            "name": "dev-client",
            "image": "sjryall/dev-client-v2:latest",
            "memory": 128,
            "portMappings": [
                {
                    "hostPort": 80,
                    "containerPort": 80
                }
            ]
        }
    ]
}

【问题讨论】:

  • 是您的图像名称6011d33fc722 。错误消息显示6011d33fc722 是图像,latest 是标签。
  • 请发布您的dockerrun.aws.json
  • 是的 6011d33fc722 是图像 ID。上面的dockerrun.aws.json文件我已经贴出来了。

标签: node.js amazon-web-services docker amazon-elastic-beanstalk dockerrun.aws.json


【解决方案1】:

您必须有一个.dockercfg 文件,其中包含您对存储库的身份验证信息,并将其存储在 s3 存储桶中。这将包括根据 docker 存储库对自己进行身份验证的凭据。

文件应如下所示。

{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "your_auth_string",
      "email": "your_email"
     }
   }
}

那么您的Dockerrun.aws.json 应该有一个身份验证部分,该部分定义了 s3 存储桶和指向您刚刚上传到 s3 的文件的密钥。

{
  "AWSEBDockerrunVersion": 2,
  "Authentication": {
    "Bucket": "bucket-that-contains-the-file",
    "Key": "location/.dockercfg"
  }
}

希望这会有所帮助。

参考: https://documentation.codeship.com/pro/builds-and-configuration/image-registries/

【讨论】:

  • 谢谢。但是我在 docker hub 上的图片是公开的,所以我很确定这不是问题。它在文档中声明:Note that on Docker Hub, you can use public images without any authentication being required.
猜你喜欢
  • 2017-07-26
  • 2020-08-11
  • 2021-11-25
  • 2021-02-03
  • 2021-02-03
  • 2017-09-22
  • 2020-07-23
  • 2015-06-20
  • 2017-11-28
相关资源
最近更新 更多