Publishing Docker images to ECR
In earlier chapters, you learned how to build and tag Docker images locally, using the todobackend sample application as an example.
You can now extend this workflow to publish Docker images to ECR, which requires you to perform the following tasks:
- Ensure you are logged into ECR
- Build and tag your Docker image with the URI of your ECR repository
- Push your Docker image to ECR
Publishing Docker images using the Docker CLI
You've already seen how to log into ECR, and building and tagging your Docker image is much the same as the local use case, except you need to specify the URI of your ECR repository when tagging the image.
The following example demonstrates building the todobackend
image, tagging the image with the URI of your new ECR repository (for the actual URI of your repository), and verifying the image name using the docker images
command:
> cd ../todobackend
> docker build -t 385605022855.dkr.ecr.us-east-1.amazonaws.com/docker-in-aws/todobackend .
Sending...