使用 AWS CLI 从 SageMaker Studio 将 docker 图像推送到 AWS ECR

Pushing docker image in AWS ECR from SageMaker Studio using AWS CLI

我们现在可以使用此代码 https://github.com/aws-samples/sagemaker-studio-image-build-cli 直接从 SageMaker Studio 将 Docker 图像发布到 AWS ECR 我确实遵循了简单的安装说明:

!pip install sagemaker-studio-image-build
sm-docker build .

还按照说明中的说明设置了信任策略和权限。 但是在将 Docker 图像推送到 AWS ECR 的阶段,我收到错误“Command 没有成功退出 docker push”。知道为什么吗?以下是作为输出打印的详细信息:

[Container] 2021/05/04 06:57:20 Running command echo Pushing the Docker image...
Pushing the Docker image...

[Container] 2021/05/04 06:57:20 Running command docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
The push refers to repository [752731038471.dkr.ecr.eu-central-1.amazonaws.com/sagemaker-studio-d-tfbogtriaiml]
An image does not exist locally with the tag: 752731038471.dkr.ecr.eu-central-1.amazonaws.com/sagemaker-studio-d-tfbogtriaiml

[Container] 2021/05/04 06:57:20 Command did not exit successfully docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG exit status 1
[Container] 2021/05/04 06:57:20 Phase complete: POST_BUILD State: FAILED
[Container] 2021/05/04 06:57:20 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG. Reason: exit status 1

在 Dockerfile 中,有对另一个文件的引用,该文件不存在于启动命令 sm-docker build . 的目录中。