The PaaS (Platform as a Service) offerings within Microsoft Azure have been getting expanded out pretty impressively lately. The “extreme PaaS” that is the serverless computing of Azure Functions is a really interesting direction for cloud computing. However, one of the of the latest changes is the ability to host Docker Containers on Linux within Azure App Service Web Apps! It seems Microsoft is starting to add Docker support to everything.
App Service Web Apps on Linux
A few weeks ago the initial preview release of Azure App Service Web Apps for Linux was released. This offers a way to host OSS applications (Node.js, Python, PHP, etc) in Azure App Service with the use of a Linux Virtual Machine (VM). This provides a great alternative to hosting all Azure Web Apps with a Windows Server VM and IIS. While IIS works, the option of using Linux is definitely more appealing to Linux and non-Microsoft developers looking to use the Microsoft Azure cloud.
To provision a new Azure App Service Web App on Linux, you can follow these steps:
- Within the Azure Portal, search the Marketplace for Web App on Linux.
- Enter the App name, Resource Group, and select an App Service Plan to create the Web App on Linux.
- Next a specific Container needs to be selected in order to configure the specific Language / Platform that will be used to deploy a Web App to the Web App on Linux App Service instance.
- Once provisioned the new Web App on Linux will be deployed out to an Ubuntu Linux VM with the specified platform container deployed and ready to go.
As you can see from the above screenshot of the available Built-in containers to choose from there are a number of Language/Platform versions to choose from. The list of language/platform versions supported by the current Preview release of Azure Web Apps on Linux are:
- .NET Core v1.0
- Node.js 6.6.0
- Node.js 6.2.2
- Node.js 4.5.0
- Node.js 4.4.7
- PHP 5.6.23
- PHP 7.0.8
There’s also another thing that can be seen within the above screenshot…
Azure Web Apps + Docker
The platform features of Azure App Service Web Apps on Linux support the deployment and configuration of the hosting environment through the use of Docker Containers. This is a huge departure and powerful feature addition to Azure Web Apps on Linux that differs from how the original Azure Web Apps hosted with Windows Server and IIS is implemented.
The use of Docker Containers to configure and host Web Apps on Linux opens up a huge amount of possibilities that help push Azure Web Apps to a more powerful service than before. The Built-In Containers that can be chosen to host Node.js, PHP, or .NET Core applications are built out as Docker Containers.
With the support for Docker Containers bring along the ability to deploy any Docker container image from Docker Hub (http://hub.docker.com) as the basis for hosting an Azure Web App on Linux. Not just Node.js, PHP, or .NET Core images can be deployed. It actually supports the deployment of any Docker Container Image from Docker Hub. It also supports both Public and Private images in Docker Hub.
In addition to supporting any Docker Container Image from Docker Hub, Web Apps on Linux also supports deploying container images from any Private registry as well. To deploy an image form a private registry, you simply provide a couple additional properties: Server URL, Login username, and Password.
The Docker Container Images used to deploy out the language / platform to host an app can be used to simply host a Web App as normally with Azure Web Apps. However, the Docker Container Image can also contain the entire application to host within Azure Web Apps on Linux; including the language / platform and the full custom application as well.
Deploy “Hello World” Container to Web App on Linux
As an example of a Docker Container Image that can be deployed to Azure App Service Web App on Linux that contains the language / platform as well as a sample, “hello world” style application, the following Docker Images can be used:
- training/webapp – “hello world” app
- dimkk/ng2-admin – sample ng2-admin dashboard
This is just a sample of a couple Docker images that can easily be used, and any Docker Image can be deployed out to an Azure Web App on Linux.
Here’s what the dimkk/ng2-admin Docker Image from Docker Hub looks like once it’s deployed out and hosted within a Web App on Linux instance:
To deploy out a Docker Image from the Docker Hub, you can use the following steps when provisioning a new Web App on Linux, or when modifying an existing Web App on Linux:
- For the Image source property, select Docker Hub.
- Specify Public or Private accordingly for the Repository Access field.
- Enter the Docker Image Name into the Image and optional tag field.
To use the ng2-admin image you can specify the Docker Image of “dimkk/ng2-admin”.
In this example, once the Web App on Linux initializes the deployment of the Docker Container image “ng2-admin” or another that implements a full application, the app will be running.
There is also the Startup Command field when configuring a Docker Container Image for a Web App on Linux to specify a specific startup command to execute once the Docker Container is deployed.
Reblogged this on The Flying Maverick.
It’s worth pointing out that if the image you are running does not expose port 80 you will not be able to access your app, you can set the Application Setting “PORT” to the correct exposed port in theportal. Also that you can access logs and bash by going to the web app in the portal selecting advanced tools -> go -> then selecting bash from the dropdown at the top.
Is there a REST api to deploy a WebApp using a docker image? It also helps if there is tooling to build a docker image from a running WebApp.
It’s not entirely clear what you’re asking. There are many tools around Docker available.
This doesn’t work for me. Can’t get my image to run as a docker container in an Azure linux web app.
Is this still supposed to work?
What are you doing that isn’t working?
Great Article! Thanks. But how couild I run the “docker exec” command using Azure Web App on Linux? Is it possible? I need it for running a scheduled job in my container.
I want to deploy a private docker image onto azure as a webapp. I want to mount a volume as well which will contain the files needed for the container to startup properly. Can I do that ? If I can, how can I create and mount the volume ? I was trying to see how can I leverage the /home which is already mounted, but could not figure out documentation for it.
I don’t know the answer to this one. You should contact Azure Support. 🙂