代码之家  ›  专栏  ›  技术社区  ›  Will Turner

将cf push与Amazon ECR一起使用?

  •  1
  • Will Turner  · 技术社区  · 7 年前

    我正在尝试执行Cloud Foundry CLI命令:cf push并让它从我们的aws ecr存储库中提取docker图像。我一直收到以下错误消息:

    Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized
    

    我已使用访问密钥ID和机密访问密钥通过aws配置命令登录aws,并已从“aws ecr get login”命令获得ecr登录。

    我可以使用docker拉取图像:

    docker pull 1234567.dkr.ecr.us-east-1.amazonaws.com/repo/example:17.5.0-SNAPSHOT
    

    所以我知道我有有效的证件。但是,这是尝试cf push命令时出现的错误:

    CF_DOCKER_PASSWORD=mypassword cf push example --docker-image 1234567.dkr.ecr.us-east-1.amazonaws.com/repo/example:17.5.0-SNAPSHOT --docker-username myusername
    Using docker repository password from environment variable CF_DOCKER_PASSWORD.
    ....<snip>
    Staging process started ...
    Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized  Going to retry attempt: 1
    Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized  Going to retry attempt: 2
    Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized  Going to retry attempt: 3
    Failed getting docker image by tag: unauthorized: access to the requested resource is not authorized
    Staging process failed: Exit trace for group:
    builder exited with error: failed to fetch metadata from [repo/example] with tag [17.5.0-SNAPSHOT] and insecure registries [] due to unauthorized: access to the requested resource is not authorized
    Exit status 2
    Staging Failed: Exited with status 2
    Destroying container
    Successfully destroyed container
    ...<snip>
    

    我尝试了aws登录和密码,还尝试了访问密钥ID和秘密访问密钥。两者都返回相同的错误。

    有没有关于如何将aws ecr与cf push集成的想法?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Daniel Mikusa    6 年前

    您可能在云控制器中遇到错误。你可以在这里看到这个故事。

    https://www.pivotaltracker.com/n/projects/966314/stories/159373079

    AWS ECR凭据相当长,在CCDB中可能会被截断。然后,当它们用于获取您的图像时,它们会失败,因为它们不正确。

    在我写这篇文章时,似乎没有解决方案,但我希望很快就会有。然后,您只需要将CF环境升级到包含修复程序的版本。你可以查看故事,故事完成后会更新。

    使现代化 -截至此次更新,cf部署中有一个可用的修复程序。