首页 > 解决方案 > 如何使用 AWS 深度学习 docker 容器

问题描述

我正在参加 Coursera 课程:AWS 计算机视觉:GluonCV 入门

在本课程中,有一个视频,其中讲师使用 docker 容器。它是一个旧视频,但我认为图像仍然存在。如果没有,我不知道如何搜索更新。该视频展示了如何创建用户账户、授予其使用 AWS docker 注册表的权限以及如何登录然后使用该账户。我已经完成了那部分。

在课程视频中,他们还演示了如何创建 EC2 实例,然后从 EC2 实例发出命令。也许这是我的问题,但我不确定。我正在尝试在本地计算机上使用 docker。由于我们正在创建一个用户 ID,因此似乎就是这种情况。只要您的用户 ID 具有权限,它就应该可以工作。

这是我正在尝试的命令:

$ aws configure

这行得通。我将我在 IAM 中创建的具有 AmazonEC2ContainerRegistryFullAccess 权限的用户帐户信息提供给它。

$(aws ecr get-login --region us-west-1 --no-include-email --registry-ids 763104351884)

这行得通。最后一行输出显示登录成功。我不知道讲师从哪里获得注册表 ID 763104351884。讲师只是提供了该号码。我对 AWS 上的 docker 了解不多,所以我不确定是否有搜索可用注册表的方法。如果是这样,那可能是个问题。

$ docker run -it 763104351884.dkr.ecr.eu-west-1.amazonaws.com/mxnet-training:1.4.1-cpu-py36-ubuntu16.04

此命令失败。这是输出:

Unable to find image '763104351884.dkr.ecr.eu-west-1.amazonaws.com/mxnet-training:1.4.1-cpu-py36-ubuntu16.04' locally
docker: Error response from daemon: Get https://763104351884.dkr.ecr.eu-west-1.amazonaws.com/v2/mxnet-training/manifests/1.4.1-cpu-py36-ubuntu16.04: no basic auth credentials.
See 'docker run --help'.

标签: amazon-web-services

解决方案


您可以在此处找到图像和存储库信息。

让我们看看你的命令:

$ docker run -it 763104351884.dkr.ecr.eu-west-1.amazonaws.com/mxnet-training:1.4.1-cpu-py36-ubuntu16.04

我们可以看到这是从区域中提取图像eu-west-1

登录时,您使用了:

$(aws ecr get-login --region us-west-1 --no-include-email --registry-ids 763104351884)

因此,您已登录到区域us-west-1,但尝试从eu-west-1.

这看起来是您问题的最可能原因。

请参阅:https ://docs.aws.amazon.com/AmazonECR/latest/userguide/common-errors-docker.html#error-403

You have authenticated to a different region

Authentication requests are tied to specific regions, and
cannot be used across regions. For example, if you obtain an
authorization token from US West (Oregon), you cannot use it
to authenticate against your repositories in US East (N.
Virginia). To resolve the issue, ensure that you have
retrieved an authentication token from the same Region your
repository exists in.

推荐阅读