Deploying Docker containers to deploying an Linux Azure Web App with ARM template

16/11/2016

At today’s Connect event Microsoft revealed the option to run docker containers inside Linux Azure Web Apps. Linux Azure Web Apps are in preview and is what the name implies web apps but on a Linux host instead of Windows.

A while back I participated in a Microsoft internal event where they did mention that they were going to bring docker support to Web Apps, so since then I have eagerly been waiting. The support is pretty minimal at the moment, you can specify a docker container (either from a private or a public docker registery) and a command to run. In the portal it looks like this
docker-on-web-apps

I’m sure docker experts will find interesting things to do with it. I have few ideas of my own, so check my blog again in a few weeks :).

In order to deploy the linux web app with an ARM template there’s a few things to note.

Deploying the docker container is just a matter of setting a few appsettings, so I assume that the installation and start of the container is actually handled by the kudu portal (I’m not sure the linux version of the Kudu portal is open sourced, if someone can point me to it let me know).

The magic settings are
[js]
{
"name": "appsettings",
"type": "config",
"apiVersion": "2016-03-01",
"dependsOn": [
"[resourceId(‘Microsoft.Web/sites’, parameters(‘appName’))]"
],
"tags": {
"displayName": "appSettings"
},
"properties": {
"DOCKER_CUSTOM_IMAGE_NAME": "nginx",
"DOCKER_CUSTOM_IMAGE_RUN_COMMAND": "nginx"
}
}
[/js]

As you can probably guess I just deploy the official image of nginx, so not a very interesting site.

nginx-in-azure-web-app

The entire template is located in this github repository: https://github.com/sjkp/Azure.ARM.LinuxWebApp.Docker/blob/master/Azure.LinuxWebApp.Docker/azuredeploy.json