teckadmin.files.wordpress.com  · web viewazure container service allows you to quickly deploy a...

13
Azure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances let you run a container in Azure without managing virtual machines and without a higher-level service.

Upload: others

Post on 11-Mar-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

Azure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster.

Azure Container Instances let you run a container in Azure without managing virtual machines and without a higher-level service.

Page 2: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances
Page 3: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

Template

{    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",    "contentVersion": "1.0.0.0",    "parameters": {        "location": {            "type": "string"        },        "containerName": {            "type": "string"        },        "imageType": {            "type": "string",            "allowedValues": [                "Public",                "Private"            ]        },

Page 4: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

        "imageName": {            "type": "string"        },        "osType": {            "type": "string",            "allowedValues": [                "Linux",                "Windows"            ]        },        "numberCpuCores": {            "type": "string"        },        "memory": {            "type": "string"        },        "restartPolicy": {            "type": "string",            "allowedValues": [                "OnFailure",                "Always",                "Never"            ]        },        "ipAddressType": {            "type": "string"        },        "ports": {            "type": "array"        },        "dnsNameLabel": {            "type": "string"        }    },    "resources": [        {            "location": "[parameters('location')]",            "name": "[parameters('containerName')]",            "type": "Microsoft.ContainerInstance/containerGroups",            "apiVersion": "2018-10-01",            "properties": {                "containers": [                    {                        "name": "[parameters('containerName')]",                        "properties": {

Page 5: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

                            "image": "[parameters('imageName')]",                            "resources": {                                "requests": {                                    "cpu": "[int(parameters('numberCpuCores'))]",                                    "memoryInGB": "[float(parameters('memory'))]"                                }                            },                            "ports": "[parameters('ports')]"                        }                    }                ],                "restartPolicy": "[parameters('restartPolicy')]",                "osType": "[parameters('osType')]",                "ipAddress": {                    "type": "[parameters('ipAddressType')]",                    "ports": "[parameters('ports')]",                    "dnsNameLabel": "[parameters('dnsNameLabel')]"                }            },            "tags": {}        }    ]}

Parameter

{    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",    "contentVersion": "1.0.0.0",    "parameters": {        "containerName": {            "value": "growfarmbag"        },        "location": {            "value": "southcentralus"        },        "imageType": {            "value": "Public"        },        "imageName": {            "value": "microsoft/aci-helloworld"        },

Page 6: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

        "osType": {            "value": "Linux"        },        "numberCpuCores": {            "value": "1"        },        "memory": {            "value": "1.5"        },        "restartPolicy": {            "value": "Never"        },        "ipAddressType": {            "value": "Public"        },        "ports": {            "value": [                {                    "port": "80",                    "protocol": "TCP"                },                {                    "port": "445",                    "protocol": "TCP"                }            ]        },        "dnsNameLabel": {            "value": "mygrowfarmbag"        }    }}

Page 7: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

Create from Azure CLI

az group create --name growfarm1 --location eastus

Where as the RG name growfarm1 and the location is eastus

DNS_NAME_LABEL=growfarm1bag

az container create \

--resource-group growfarm1 \

--name mycontainer \

--image microsoft/aci-helloworld \

--ports 80 \

--dns-name-label $DNS_NAME_LABEL \

--location eastus

NOTE : The image name, microsoft/aci-helloworld, refers to a Docker image hosted on Docker Hub that runs a basic Node.js web application.

az container show \

--resource-group growfarm1 \

--name mycontainer \

--query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" \

Page 8: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

--out table

FQDN ProvisioningState

------------------------------------- -------------------

growfarm1bag.eastus.azurecontainer.io Succeeded

Delete

az container delete --name mycontainer --resource-group growfarm1

Are you sure you want to perform this operation? (y/n): y

Creating containers from Azure powershell

Create a resource groupNew-AzResourceGroup -Name labrg -Location EastUS

Create a container used windows OSNote : This image packages Microsoft Internet Information Services (IIS) to run in Nano Server.

Page 9: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

New-AzContainerGroup -ResourceGroupName labrg -Name mylabcontainer -Image mcr.microsoft.com/windows/servercore/iis:nanoserver -OsType Windows -DnsNameLabel mylab-demo-win

View the container and details Get-AzContainerGroup -ResourceGroupName labrg -Name mylabcontainer

Access it with IP or FQDN

Page 10: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

Clean upRemove-AzContainerGroup -ResourceGroupName labrg -Name mylabcontainer

Page 11: teckadmin.files.wordpress.com  · Web viewAzure Container Service allows you to quickly deploy a production ready Kubernetes, DC/OS, or Docker Swarm cluster. Azure Container Instances

https://docs.microsoft.com/en-us/learn/modules/run-docker-with-azure-container-instances/2-run-acihttps://docs.microsoft.com/en-us/learn/modules/run-docker-with-azure-container-instances/3-restart-policieshttps://docs.microsoft.com/en-us/learn/modules/run-docker-with-azure-container-instances/4-use-environment-variableshttps://docs.microsoft.com/en-us/learn/modules/run-docker-with-azure-container-instances/5-use-data-volumeshttps://docs.microsoft.com/en-us/learn/modules/run-docker-with-azure-container-instances/6-troubleshoot-acihttps://docs.microsoft.com/en-us/cli/azure/container?view=azure-cli-latesthttps://docs.microsoft.com/en-us/azure/container-registry/container-registry-delete