Azure

How To Deploy A Docker Based mostly Net Software On Azure

Introduction

 

Cloud suppliers facilitate an environment friendly method to run and deploy containerized functions with lowered value of infrastructure. In case you are working your utility by means of containers, Microsoft Azure supplies the ability to deploy such functions utilizing azure app providers.

 

On this article, I’m going to cowl how a Docker-based .NET Core net utility may be deployed on Azure app providers.

 

 

Conditions

  1. Energetic Azure subscription
  2. Fundamental information of docker and deploying web-based functions on Azure

Steps to deploy docker based mostly net utility on Azure app service 

 

Create an Azure container registry

 

Very first thing, We have to present our Docker picture to azure. The picture may be offered by means of public repository like docker hub nonetheless it is strongly recommended to make use of a personal repository in case you are working with company functions.

 

Azure supplies an Azure container registry to register your picture on Azure in a safe approach.

 

On this step, we’re going to create an azure container registry utilizing CLI and retailer pictures on it in order that will probably be accessible to azure app providers. Beneath is the command to create an Azure container registry

 

az acr create –name <container registry identify > -g <useful resource group identify > –sku <Fundamental>

 

You should utilize an present useful resource group or can create a brand new useful resource group utilizing the command:

 

az group create –name <useful resource group identify> –location <area>

 

Create & Push picture to Azure container registry

 

As a way to create a picture you need to give the tag of the picture in under particular format

 

<registry identify >.azurecr.io/<picture identify>:<model>

 

Model is non-obligatory, however it’s good observe to offer a model

 

Command to construct a picture,

 

docker construct –t <registry identify >.azurecr.io/<picture identify>:<model>

 

In case you’ve gotten already created the picture, you’ll be able to tag that picture in a specified format utilizing the under command:

 

docker tag <picture identify> <registry identify >.azurecr.io/<picture identify>:<model>

 

Earlier than pushing the registry, you need to login into the Azure container registry utilizing the under command:

 

az acr login — identify <acr identify>

 

The final step is to push this picture into the Azure container registry utilizing the under command. It’d take a while to push your picture:

 

docker push <registry identify >.azurecr.io/<picture identify>:<model>

 

Create Azure net apps for containers

 

Now you’ve gotten a picture printed on azure container registry, Its time to create a container occasion utilizing Azure CLI. You should utilize your azure portal UI to do that as nicely, right here I’m demonstrating utilizing the Azure CLI

 

Command to create container:

 

az container create –resource-group <useful resource group Title> –name <containername> –image <registry identify>.azurecr.io/<picture identify>: <model> –cpu 1 –memory 1 –registry-login-server <azure registry> –registry-username <username> –registry-password <password> –dns-name-label <app dns identify> –ports <portnumber>

 

e.g.

 

az container create –resource-group rgdocker –name container-001 –image docreg.azurecr.io/myapp:v1 –cpu 1 –memory 1 –registry-login-server docreg.azurecr.io –registry-username <username> –registry-password <pwd> –dns-name-label my-app –ports 5000

 

Entry the working utility

 

As soon as your container efficiently created and began, you’ll be able to immediately entry your app utilizing the DNS identify which was specified throughout the container creation within the earlier step.

 

To entry the appliance, you’ll be able to immediately hit the URL e.g. (http://myapp.westus.azurecontainer.io:5000).

 

You possibly can examine logs of your container by way of the next command in case you wish to troubleshoot.

 

az container logs — resource-group <ResourceGroupName> — identify <ContainerName>

 

Conclusion

 

Azure supplies a platform to simply run and deploy the containerized utility. It’s effectively sustaining the Azure container registry and simple to push the picture on it.

 

Azure GUI supplies a really good interface to carry out all duties with out utilizing CLI.

 

I hope will probably be useful to you to jumpstart Docker together with the Azure cloud service supplier.

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button