1. Choose Your Container Service
Azure offers a variety of services to run your containers, each with different management capabilities and use cases.
- Azure Kubernetes Service (AKS): For orchestrated container deployments, scaling, and management.
- Azure Container Instances (ACI): For running single containers without managing infrastructure.
- Azure Container Registry (ACR): A private Docker registry service to store and manage your container images.
For most production workloads, AKS is the recommended choice. For simple tasks or event-driven scenarios, ACI might be more suitable.
Learn More
2. Set Up Your Environment
Before deploying, ensure you have the necessary tools and Azure resources in place.
- Install Azure CLI: The command-line interface for managing Azure resources.
- Install Docker: To build and run containers locally.
- Create an Azure Account: If you don't have one already.
- Create an Azure Resource Group: A logical container for your Azure resources.
$ az group create --name myResourceGroup --location eastus
3. Deploy Your First Container
Let's deploy a simple containerized web application. We'll use Azure Container Instances (ACI) for a quick start.
Using Azure Container Instances (ACI)
This is the simplest way to run a container on Azure. No orchestration needed!
$ az container create --resource-group myResourceGroup --name mywebcontainer --image mcr.microsoft.com/azuredocs/aci-helloworld --dns-name myhelloworld-xyz
After creation, you can access your web application via the provided DNS name.
Deploy with ACI
4. Explore Azure Kubernetes Service (AKS)
For more complex deployments, AKS provides a managed Kubernetes experience.
Setting up AKS
Creating an AKS cluster involves a few more steps. You'll need to install kubectl (Kubernetes command-line tool) and follow the AKS creation guide.
$ az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keys
Connect to your cluster:
$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
Deploy with AKS