Part 5 - Push the Container to the Amazon Elastic Container Registry

In this task we will push the container from Visual Studio to ECR.

1. Let’s start by opening the docker-compose.yml file and copy the image name.

a

2. Next let’s create a new ECR repository. From the AWS Explorer menu expand the Amazon Elastic Container Service section and right-click Repositories and click on Create Repository

a

3. Enter the Docker compose image name from step #1 above (mvcmusicstorewedf2017) and click OK.

a

a

5. From the AWS CLI tab copy the first command (1. Retrieve the docker login command that you can use to authenticate your Docker client to your registry). We will use the output of this command to allow Visual Studio to authenticate and push the container to our repository.

a

6. Copy the command from the previous step and run the command as an administrator. The output contains three values: -u for username, -p for password, and the URL of the repository. Leave this command prompt open and we’ll copy these values to use in the next step.

a

7. Now let’s configure the publish action on the project. We are going to configure a publish action to a custom container registry. Right-click the project and select Publish.

a

8. Select New under the drop down that will say ‘FolderProfile’, then select Container Registry, then Custom and click Create Profile. Now we can copy/paste the values from the previous command prompt window in to the Visual Studio Publish UI.

a

9. Once the values are entered and you click Publish, Visual Studio will begin to publish the container to your ECR repository on AWS. A Docker prompt will appear to indicate progress of the publish action.

a

10. Once the publish action is complete you can go back and refresh the repository view from the AWS Explorer and you should see that your repository now has one container image.

a

Congratulations you now have a container image in AWS that you can deploy to your ECS environment. In the next task we will deploy your container as a task within ECS.