Microsoft's relationship with Docker has evolved and matured over the past few years, leading to a more strategic partnership and thus prompting greater service and product integrations. For instance, Windows Server 2016 comes OOB with support for Docker engine, making it simple to utilise vanilla virtual machines with customised container images.
As far as Azure is concerned, we have a number of different integration points. Be it our first party Azure Container Service, 3rd party container orchestrators or just plain old infrastructure. Extending this portfolio, we have now announced Docker integration into our PaaS offering; Web Apps.
This allows you to utilise our most popular Azure service, App Service Web Apps, whilst developing and deploying your code as a self contained Docker container. In this blog I will run through a simple 'Hello World' example of how to get started using this new capability.
If like me, you read the headlines: 'Docker support added to Azure App Service' and immediately dived into the Portal and tried to create a new Web App, then I'm sure you were equally disappointed to find no options for configuring a Docker container. This is because Web Apps with Docker support is actually only surfaced in our Linux based Web App preview service. Therefore, rather than provisioning a
Web App, try creating a Web App on Linux.
You should now see a few different options, we're going to select the top one 'Web App On Linux (Preview)' and then select create.
This will expand the configuration blade. You should see the usual fields to complete i.e. App name, Subscription, Resource group etc. However, you should see an additional tab called *Configure container. Expanding this tab will give a few options. You will be presented with a list of default 'Runtime Stacks'. These defaults allow you to quickly provision a container with the required technology stack, which you will then need to deploy your application into to.
Alternatively, you can use a publically hosted Docker image from Docker Hub by selecting the appropriate option. These hosted container images do not need to be vanilla stacks, they can also include your custom application. The service should be able to run any given container without modification. If it has no embedded application, then you'll need to deploy it, if it does then it'll be executed on start up. As you can see in the below image, there is an additional Startup Command field that allows you to provide a custom execution command if you want to override any parameters for instance.
The final option, is to deploy a container image from a privately hosted Docker registry. This could be hosted on Azure or externally, simply provide the server URL and your credentials and the Docker engine will attempt to fetch your image on start up.
That's about it for this simple introduction to the service. I've use a simple 'Hello World' Docker image that Docker provide as part of their training suite. After pointing the service to the public registry 'training/webapp', the service did the rest to make sure the image was pulled and then started.
For those wondering, this is fairly different to how the original Web Apps IIS implementation works, however, you still benefit from all the additional tooling, extensions and management capabilities of the original offering.