Push an ASP.NET Core API Container to Azure Container Registry Part 2 of 2
App Dev Manager Greg Roe explores hosting cross platform ASP.NET Core Applications with containers in this two part series.
This is part 2 of 2. See Part 1 “Hosting cross platform ASP.Net Core Applications”. Is the last article we built and demonstrated hosting an ASP.NET core api app “Blue Yonder Hotel Service” in a Docker Containers. The api will expose api service endpoint to call hotel services. In this Part 2 we will push the container to Azure Container Registry.
To recap, ASP.NET Core is a cross-platform, open-source framework for building modern, cloud-based, connected applications. With ASP.NET core you can build web apps, API APS, microservices, mobile backends, and IoT apps. You can use your development tools of choice on Windows MacOS, and Linux. You can deploy in any cloud, or on premises. You can run in native cloud services such as Azure Web Apps, Linux, or, Containers. You can push and store the container in the secure Azure Container Registry.
We’ll use the dotnet cli a cross platform took for developing, building, running, and publishing .Net Core apps and Visual Studio Code, Microsoft’s open source, cross-platform code editor that runs everywhere.
- Create an Azure Container Registry instance:
Logon to portal.azure.com
Create resource/ Container Registry
Enter a Name,Resource Group, Location, and SKU.
Click Access Keys and then follow these steps
Login to ACR: Docker login gjracractivateazure.azurecr.io
Get the image id: Docker Image
Tag the image: docker tag 5d4fb8198d39 gjracractivateazure/hotels_service:1.0
- Push the Container to Azure Container Registry
Docker push gjracractivateazure/hotels_service:1.0
- On the portal in your ACR instance, in “repositories, you will see your pushed container image”