Back to Browse

Azure Serverless containers | Azure Container Instances using Docker CLI | Complete Hands On

1.2K views
Premiered Jul 18, 2021
29:53

Azure Container Instances - Hands On Demo 0:00 Introduction to ACI 1:56 Prerequisites 3:03 Use Azure CLI to login to azure 4:20 Create Azure Resource group using Azure CLI 5:09 Create and use Docker ACI context 6:55 Deploy docker containers on azure using Docker CLI 12:19 Preparation to Deploy multi-container group 12:29 Create and login to Azure Container Registry 16:37 Deploy a multi-container group using Docker Compose 24:37 Connect to your running docker container from Azure Portal 26:52 Clean up, remove resource groups and delete the docker aci context 29:01 Ending Remarks Some useful links I have referenced for this demo: - Documentation on Azure Container Instances https://docs.microsoft.com/en-us/azure/container-instances/ - Quickstart: Deploy a container instance in Azure using the Docker CLI https://docs.microsoft.com/en-us/azure/container-instances/quickstart-docker-cli - Tutorial: Deploy a multi-container group using Docker Compose https://docs.microsoft.com/en-us/azure/container-instances/tutorial-docker-compose - Docker Docs: Deploying Docker containers on Azure https://docs.docker.com/cloud/aci-integration/ Prerequisites : - Azure Account (You can start free) https://azure.microsoft.com/en-us/free/ - Create Azure Subscription if you donot have Free Trail https://docs.microsoft.com/en-us/azure/cost-management-billing/manage/create-subscription - Install Azure CLI on your machine - Install Azure cli https://docs.microsoft.com/en-us/cli/azure/install-azure-cli - Install Docker Desktop or Docker Engine on your machine - https://docs.docker.com/get-started/#download-and-install-docker Login to Azure and Select Subscription az login az account list az account show az account set --subscription subscription id Create a resource group az group create --name rgacicontext --location eastus Docker login to Azure docker login azure Create docker aci context docker context create aci abacicontext List avaiable docker context docker context ls Create a container in azure - First, switch to the ACI context. docker context use myacicontext - docker run command to create the Azure container instance with port 80 exposed to the internet: docker run -p 80:80 mcr.microsoft.com/azuredocs/aci-helloworld - List container you have created on azure docker ps Sample output shows a public IP address, in this case 52.230.225.232: - Now go to the IP address in your browser. If you see a web page similar to the following, congratulations! You've successfully deployed an application running in a Docker container to Azure. Pull the container logs docker logs contianer-id Clean up resources - Stop Container docker contianer-id - Remove container docker rm contianer-id Tutorial: Deploy a multi-container group using Docker Compose Create a resource group az group create --name aciresourcegroup --location eastus Once you've created the resource group, create an Azure container registry az acr create --resource-group aciresourcegroup --name acrName --sku Basic Login to azure container registry from your local machine az acr login --name acrName Clone application code from github git clone https://github.com/Azure-Samples/azure-voting-app-redis.git cd azure-voting-app-redis Modify Docker compose file The file configures the azure-vote-back and azure-vote-front services. - Update the image property in the azure-vote-front service. - Prefix the image name with the login server name of your Azure container registry, acrName.azurecr.io. - Change the ports mapping to 80:80. Save the file. Test Run multi-container application locally Swtich to default docker context pointing to local machine docker context use default Build and Start your containers docker-compose up --build -d Check image built from above command docker images List running containers docker ps To see the running application, enter http://localhost:80 in a local web browser. Stop the application and remove the containers. docker-compose down Push image to container registry docker-compose push Verify the image is stored in your registry az acr repository show --name acrName --repository azure-vote-front Deploy application to Azure Container Instances Switch docker context to azure aci context docker context use myacicontext Start containers in azure from your local machine docker compose up Check deployed contaiers docker ps To see the running application in the cloud, enter the displayed IP address in a local web browser. Check logs of running contianer docker logs container-id Delete container group in Azure Container Instances docker compose down Clean Up : Remove resource groups created for this demo az group list az group delete -n aciresourcegroup az group delete rgacicontext

Download

1 formats

Video Formats

360pmp441.1 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Azure Serverless containers | Azure Container Instances using Docker CLI | Complete Hands On | NatokHD