Philiz
Philiz

Reputation: 333

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

We can now publish Docker images to AWS ECR directly from SageMaker Studio using this code https://github.com/aws-samples/sagemaker-studio-image-build-cli I did follow the easy installation instructions:

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

Also Trust policy and permissions have been set as described in the instructions. But I'm getting the error "Command did not exit successfully docker push" at the stage where it is pushing the Docker image to AWS ECR. Any idea why? Here are the details print as output:

[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

Upvotes: 0

Views: 2137

Answers (1)

Philiz
Philiz

Reputation: 333

In the Dockerfile, there was a reference to another file that was not present in the directory from where the command sm-docker build . was launched.

Upvotes: 1

Related Questions