Azure

Docker Container With Azure Container Occasion

Introduction

On this article, we’ll discover the right way to create a containerized utility in Azure and the way we will attain it out from the surface world.

Advantages of utilizing container occasion

  • Azure container occasion could be launched in few seconds immediately
  • Pricing shall be charged per second when the occasion is working
  • Safer and clear isolation between the appliance and platform
  • Flexibility and management on container CPU cores and reminiscence
  • Capability to create persistent storage for containers with Azure File Share
  • Work with the identical APIs for each Linux and Home windows VMs

After understanding the advantages of Azure Container, let’s perceive the right way to create an Azure Container Occasion. You want the under assets earlier than creating an Azure container occasion.

  • Azure Subscription 
  • Azure Useful resource Group

Let’s create a container occasion in Azure.

DNS_NAME_LABEL=aci-demo-321
az container create --resource-group acr-d-rg --name mycontainer --image mcr.microsoft.com/azuredocs/helloworld --ports 80 --dns-name-label $DNS_NAME_LABEL --location westeurope

As soon as the container is created, we will browse the container utilizing the FQDN.

Container Restart Coverage

Azure Container has three totally different restart insurance policies.

Set Surroundings Variables 

We are able to use Azure Powershell/Azure CLI or Azure Portal to set and create atmosphere variables for Azure container situations. We are able to preconfigure the atmosphere variables to keep away from displaying delicate data.

For instance, we’ll create an Azure Cosmos DB occasion and use the atmosphere variable to cross on the connection data.

Step 1: Create Azure Cosmos DB

COSMOS_DB_NAME=aci-cosmos-db-21
COSMOS_DB_ENDPOINT=$(az cosmosdb create --resource-group acr-d-rg --name $COSMOS_DB_NAME --query documentEndpoint --output tsv)

Step 2: Deploy Cosmos DB to container

az container create --resource-group acr-d-rg  -name aci-d --image mcr.microsoft.com/azuredocs/azure-vote-front:cosmosdb --ip-address Public --location westeurope --environment-variables COSMOS_DB_ENDPOINT=$COSMOS_DB_ENDPOINT COSMOS_DB_MASTERKEY=$COSMOS_DB_MASTERKEY

Information Quantity in Azure Container Occasion

By default, Azure container situations are stateless. As a consequence of which we will lot all the info if the container fails. As a way to keep away from such points, we will additionally mount a quantity from an exterior retailer.

Steps to create persistent storage utilizing Azure File Storage is as follows,

Create Storage Account

STORAGE_ACCOUNT_NAME=mystorageaccount231
az storage account create --resource-group acr-d-rg --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --location westeurope

Create an atmosphere variable for storage account key

export AZURE_STORAGE_CONNECTION_STRING=$(az storage account show-connection-string --resource-group acr-d-rg --name $STORAGE_ACCOUNT_NAME --output tsv)

Create a fileshare,

az storage share create --name aci

Deploy a container and mount fileshare,

az container create --resource-group acr-d-rg --name aci --image mcr.microsoft.com/azuredocs/aci-hellofiles --location westeurope --ports 80 --ip-address Public --azure-file-volume-account-name $STORAGE_ACCOUNT_NAME --azure-file-volume-account-key $STORAGE_KEY --azure-file-volume-share-name aci-share --azure-file-volume-mount-path /aci/logs/

After understanding the container creation and deployment of the Azure cosmos DB container, Let’s additionally discover the right way to troubleshoot Azure Container Cases. We’ll discover about under factors,

  • Get Container Logs
    az container logs –resource-group acr-d-rg –name aci-demo
     
  • Visualize container occasions
    az container connect –resource-group acr-d-rg –name aci-demo

Conclusion

On this article, we explored the azure container occasion and the right way to create and deploy Azure providers to the Azure container occasion.

Show More

Related Articles

Leave a Reply

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

Back to top button