How to use VSTS docker task to push to AWS registry?

Recently couple of customers wanted to know how to use VSTS docker task to push the container images to AWS EC2 Container Registry. Atul Malaviya tried it out and it worked without seamlessly for me. Here are the steps that worked for him.

  • Create a repository in the AWS registry.
  • Specify the repository name in the docker task.
  • Get the EC2 container registry credentials using the below command which will return you a user name, a password and a registry ecr get-login --no-include-email --region us-west-2
  • Use the above parameters to create a service endpoint to the aws registry from VSTS as shown in the image below
  • With this VSTS Docker task was able to successfully build and push an image to AWS container registry !!