Continuous deployment with Web App for Containers

In this tutorial, you configure continuous deployment for a custom container image from managed Azure Container Registry repositories or Docker Hub.

Sign in to Azure

Sign in to the Azure portal.

Enable the continuous deployment feature

Enable the continuous deployment feature by using Azure CLI and executing the following command:

az webapp deployment container config --name name --resource-group myResourceGroup --enable-cd true

In the Azure portal, select the App Service option on the left side of the page.

Select the name of the app for which you want to configure Docker Hub continuous deployment.

On the Docker Container page, select On, and then select Save to enable continuous deployment.

Screenshot of app setting

Prepare the webhook URL

Obtain the webhook URL by using Azure CLI and executing the following command:

az webapp deployment container show-cd-url --name sname1 --resource-group rgname

For the webhook URL, you need the following endpoint: https://<publishingusername>:<publishingpwd>@<sitename>.scm.azurewebsites.net/docker/hook.

You can obtain your publishingusername and publishingpwd by downloading the web app publish profile using the Azure portal.

Screenshot of adding webhook 2

Add a webhook

Azure Container Registry

  1. On your registry portal page, select Webhooks.
  2. To create a new webhook, select Add.
  3. In the Create webhook pane, give your webhook a name. For the webhook URI, provide the URL obtained in the preceding section.

Make sure you define the scope as the repo that contains your container image.

Screenshot of webhook

When you update the image, the web app is updated automatically with the new image.

Docker Hub

On your Docker Hub page, select Webhooks, and then CREATE A WEBHOOK.

Screenshot of adding webhook 1

For the webhook URL, provide the URL that you obtained earlier.

Screenshot of adding webhook 2

When you update the image, the web app is updated automatically with the new image.

Next steps