Skip to content

Instantly share code, notes, and snippets.

@Satak
Created June 13, 2019 20:53
Show Gist options
  • Save Satak/4f5a836377b1093f5720cd31ba4293da to your computer and use it in GitHub Desktop.
Save Satak/4f5a836377b1093f5720cd31ba4293da to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"containerName": {
"type": "string"
},
"dnsNameLabel": {
"type": "string"
},
"imageName": {
"type": "string",
"metadata": {
"description": "Container image to deploy. Should be of the form accountName/imagename:tag for images stored in Docker Hub or a fully qualified URI for a private registry like the Azure Container Registry."
},
"defaultValue": "microsoft/aci-helloworld"
},
"osType": {
"type": "string",
"defaultValue": "Linux",
"allowedValues": [
"Linux",
"Windows"
]
},
"numberCpuCores": {
"type": "int",
"defaultValue": 1
},
"memory": {
"type": "string",
"defaultValue": "1.5"
},
"restartPolicy": {
"type": "string",
"defaultValue": "Always",
"allowedValues": [
"OnFailure",
"Always",
"Never"
]
},
"port": {
"type": "string",
"metadata": {
"description": "Port to open on the container and the public IP address."
},
"defaultValue": "80"
}
},
"resources": [
{
"location": "[resourceGroup().location]",
"name": "[parameters('containerName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2018-10-01",
"properties": {
"containers": [
{
"name": "[parameters('containerName')]",
"properties": {
"image": "[parameters('imageName')]",
"resources": {
"requests": {
"cpu": "[parameters('numberCpuCores')]",
"memoryInGB": "[float(parameters('memory'))]"
}
},
"ports": [
{
"protocol": "Tcp",
"port": "[parameters('port')]"
}
]
}
}
],
"restartPolicy": "[parameters('restartPolicy')]",
"osType": "[parameters('osType')]",
"ipAddress": {
"type": "Public",
"dnsNameLabel": "[parameters('dnsNameLabel')]",
"ports": [
{
"protocol": "Tcp",
"port": "[parameters('port')]"
}
]
}
}
}
],
"outputs": {
"containerIPv4Address": {
"type": "string",
"value": "[reference(resourceId('Microsoft.ContainerInstance/containerGroups/', parameters('containerName'))).ipAddress.ip]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment