As 1st step create a .NET Core console application, "TImeStamp", to display current UTC date time.
Create Azure Container Registry -
Azure Container Registry aka ACR can be used to store your build repositories. You should create an Azure Container Registry with all default settings as below. Please notice that my ACR name is "mytestingacr" and currently there isn't any repositories in it.
Enable Docker to "TImeStamp" App -
I used VS 2019 to add Docker support to my sample .NET Core application. Its just a right-click on project as below.
Above step will be adding a docker file as below, which includes all commands to build the container. These commands will be executed by ACR, not locally.
Tool to Execute CLI Commands -
Azure CLI commands can be used to communicate to Azure from your local machine. This time I used "Git Bash" windows as a tool to execute Azure CLI commands. You need to go to the root folder of the sample application. Then follow below steps to enable Azure CLI in Git Bash.
- Go C:\Program Files\Git\etc\profile.d
- Edit aliases.sh, to add a new alias for az as, alias az='az.cmd'
You are now ready to execute Azure CLI commands. Below are the steps
- Build "TImeStamp" App as a Container - Use below CLI command to upload your code and build it inside ACR
az acr build -t jaishdemo/timestamp -r mytestingacr -f Dockerfile .
This is telling that build in acr with a tag "jaishdemo/timestamp", which will be the repository name inside ACR. I also mentioned my ACR name to argument "-r". Last 2 arguments are docker file name to be used for build and also the context to be considered. My context is the root folder of the sample application and so just mentioned as "." . Please notice the status showing from creating a .TAR file and uploading it to ACR and queue for build etc... below.
After successful ACR build, you see below last set of status through command window. Please notice image repository details mentioned there as "jaishdemo/timestamp".





Join the conversation! Your thoughts help the community grow.