Azure Container Registry Build Supports All Windows Versions (Preview of Preview)

ACR Build, a cloud-native container build capability of the Azure Container Registry now supports all supported versions of Windows Containers.

In May of 2018, Azure announced ACR Build (Preview), a component of Azure's OS & Framework Container Life-cycle Management Today, we wanted to give customers early access to Windows Builds, in addition to the Linux and ARM builds customers could do since last May.

ACR Build Enables All Supported Versions of Windows Containers

The most significant element of Windows support is the support for all supported version of Windows, including ltsc2016, 1709 and 1803. In addition to Windows Server Core, Nano Server is also supported by ACR Build.

A suite of tests for Windows containers are available here: https://github.com/AzureCR/acr-builder-os-tests/tree/master/Windows

What is (Preview of Preview)

Updates to the az cli will not be publicly available until July 31. There are two ways to get ACR Build for Windows Container support today (July 16th, 2018)

  1. Create a build task with the public az cli
    build-task already supports the --os parameter, so you're good to go if you just want build-tasks
  2. To use az acr build; the equivalent of docker build, use a preview build of the az cli, which can be
    1. installed directly: https://github.com/Azure/azure-cli#edge-builds
    2. or with a docker image: https://github.com/Azure/azure-cli#docker docker run -v ${HOME}:/root -it azuresdk/azure-cli-python:dev

A quick test

We'll use the most consistent way, a docker container of the dev builds of the az cli

  • On Windows, or Mac, instance a docker container, running the latest dev build, including updates to az acr build docker run -v ${HOME}:/root -it azuresdk/azure-cli-python:dev
  • Note: ACR Build is currently supported:
    • East US
    • West Europe
    • Central US
    • South Central US
      More regions are coming on weekly, with full global coverage coming "soon"
  • Build a Windows Server Core image, with a .NET Framework app
    az acr build \ -t helloworld-windowsservercore:multi-arch-{{.Build.ID}} \ -f helloworld-windowsservercore/multi-arch.Dockerfile \ --os windows \ https://github.com/AzureCR/acr-builder-os-tests.git#master:Windows/Servercore

How this works:

  • az acr build is the functional equivalent of docker build. Rather than having to install the docker client, az acr build sends the context to an ACR Build server in Azure
  • -t uses the standard docker tag, with the added ability to get a unique build id.
  • -f uses the standard dockerfile syntax to reference a Dockerfile that isn't in the root of the context
  • --os tells ACR Build to use a Windows host. As many FX and platform tags are multi-arch, this parameter is required to specify which OS you require for docker build
  • https://github... is a remote context for the build. While . is supported for a local directory, acr build and build-task can also specify remote git repos, avoiding the necessity of first git clone

Since this references the multi-arch tag for Windows and the .NET Framework, this will produce an 1803 version of Windows Server Core. To get a specific windows version, use the following:

  • Windows Server 1709, using the 1709.Dockerfile az acr build \ -t helloworld-windowsservercore:1709-{{.Build.ID}} \ -f helloworld-windowsservercore/1709.Dockerfile \ --os windows \ https://github.com/AzureCR/acr-builder-os-tests.git#master:Windows/Servercore
  • Windows Nano Server 1709, using the 1709.Dockerfile for Nano Server and .NET Core
    az acr build \ -t helloworld-nanoserver:1709-{{.Build.ID}} \ -f helloworld-nanoserver/1709.Dockerfile \ --os windows \ https://github.com/AzureCR/acr-builder-os-tests.git#master:Windows/Nanoserver

Automated Build Tasks, based on Git Commits, or Based Image Updates

The primary scenario for ACR Build revolves around Container OS & Framework patching. Just as your builds kick off, based on git-commit changes, as base images are patched, your builds can also be triggered.

See Overview of ACR Build, targeting OS & Framework Patching for more details.

Creating automated builds

Note: this can be done directly with the publicly released az cli, however, we'll use the az cli docker image for consistency.

  • Fork the https://github.com/AzureCR/acr-builder-os-tests repo
  • Create a Personal Access Token.
    For more info, see the ACR Build Docs for creating a build task.
  • Set the PAT to an environment variable
    PAT=[pastePAT]
  • Create an acr build-task
    az acr build-task create \ -n HelloworldWinServercoreLtsc2016 \ -t helloworld-windowsservercore:ltsc2016-{{.Build.ID}} \ -f helloworld-windowsservercore/ltsc2016.Dockerfile \ -c https://github.com/AzureCR/acr-builder-os-tests.git#master:Windows/Servercore \ --os windows \ --git-access-token $PAT
  • Trigger a build manually
    az acr build-task run HelloworldWinServercoreLtsc2016

For more information

Any other feedback, feel free to leave larger comments here, user voice, twitter (@SteveLasker)

Thanks,
Steve and the great members of the ACR team