Carl Fischer

Docker for Windows Desktop 18.02 with Windows 10 Fall Creators Update

The headline feature in Docker for Windows Desktop 18.02 is the option for an automated Kubernetes cluster, enabling native support of your favorite Kubernetes tools with Linux containers on your Windows desktop. That’s a big deal. You can try it out by using the whale icon in the system tray to set Docker for Windows Desktop into Linux containers mode, and then enabling Kubernetes support via the Settings menu. If you use current Windows 10 Insider builds please be aware of a Windows platform issue that affects Linux containers in Docker for Windows Desktop.

But that’s not all. This post covers additional progress on experimental support for Microsoft’s Linux containers on Windows (LCOW). Docker for Windows 18.02 now supports Linux and Windows containers running side-by-side via LCOW, using a single Docker daemon.

More on the evolution of LCOW:

How to get it

Docker for Windows Desktop 18.02 is an Edge channel release. If your copy of Docker for Windows Desktop is set to the Edge or Nightly channel you will receive the update automatically. Users on the Stable channel will need to switch to Edge or Nightly via the Setting dialog to receive the update.

Note: LCOW requires Hyper-V isolation, and therefore Windows 10 must be running on bare metal or a virtualization platform that supports nested virtualization such as Hyper-V or Azure Dv3 and Ev3 instances. Your mileage may vary with other virtualization platforms.

Try it out

Prior versions of Docker for Windows Desktop contained three operating modes: Windows containers, run via native Windows support, Linux containers, run via a managed Hyper-V Linux VM, and LCOW. As of 18.02 there is no longer a separate LCOW mode, in Windows mode LCOW is now used to run both Windows and Linux containers. The existing Linux mode is preserved for use while LCOW development continues. To switch modes use the whale icon in the system tray.

LCOW introduces a primary concept of a single Docker engine being capable of running images for more than one operating system. When performing operations that pull an image for the first time a directive is required to ensure the image and host operating operating system are properly matched. In this release that directive is the --platform flag.

LCOW The default platform is Windows, so running a Linux container without specifying the --platform flag will return an error:

docker run --rm busybox echo hello 
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
docker.exe: no matching manifest for windows/amd64 in the manifest list entries.
See 'docker.exe run --help'.

Adding the --platform linux flag allows the container to be successfully pulled and run:

docker run --rm --platform linux busybox echo hello
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
57310166fe88: Pull complete
Digest: sha256:1669a6aa7350e1cdd28f972ddad5aceba2912f589f19a090ac75b7083da748db
Status: Downloaded newer image for busybox:latest
hello

Once the image has been pulled with the platform specified, the --platform flag is no longer required:

docker run --rm busybox echo hello
hello 

Now for the win (pun intended) run a Windows container side-by-side with Linux containers:

docker run --rm microsoft/nanoserver:1709 cmd
Unable to find image 'microsoft/nanoserver:1709' locally
1709: Pulling from microsoft/nanoserver
407ada6e90de: Pull complete
711a33cda32c: Pull complete
Digest: sha256:c633d0187bcb73948ac51c8d84f19948b4151dc71274fced7ce204bbe403f33d
Status: Downloaded newer image for microsoft/nanoserver:1709
Microsoft Windows [Version 10.0.16299.192]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\>

Image listings include both Linux and Windows:

docker image ls
REPOSITORY              TAG      IMAGE ID      CREATED        SIZE
busybox                 latest   5b0d59026729  13 days ago    3.41MB
microsoft/nanoserver    1709     c4f1aa3885f1  4 weeks ago    303MB

Future releases may provide heuristic-based options in addition to the --platform flag.

To change the default platform to Linux:

[Environment]::SetEnvironmentVariable("LCOW_API_PLATFORM_IF_OMITTED", "linux", "Machine")
Restart-Service Docker

hello-world and manifest list images

The eagle-eyed reader may have noticed that the examples above do not use the ubiquitous library/hello-world image. That’s on purpose, to show how LCOW and the --platform flag work with the majority of images you’ll run across. However some images, like those in the library repository, are constructed with manifest lists, or “fat manifests”. Manifest lists were contributed by Docker Captain Phil Estes, and allow an image author to specify a digest to use for different architectures, operating systems, and OS versions.

When a specified image has a manifest list, the Docker engine automatically selects the manifest entry to use based on the platform it’s running on. When manifest lists are combined with LCOW the result is a single image that can be referenced by --platform windows or --platform linux. Note that only a single instance of a manifest list image can be pulled on a given Docker engine.

The manifest for hello-world includes entries for both Windows and Linux (and others, the full list is clipped for brevity).

 {
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 524,
"digest": "sha256:8072a54ebb3bc136150e2f2860f00a7bf45f13eeb917cca2430fcd0054c8e51b",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 525,
"digest": "sha256:f839819df2d0d86fad4f53641de64f6e90ae3b77d6ca28011c77ad34aa7afd92",
"platform": {
"architecture": "s390x",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1358,
"digest": "sha256:65b067b5940d834f7534027d90e47c634c4ab0c9d51d9a4a363166bb40787c15",
"platform": {
"architecture": "amd64",
"os": "windows",
"os.version": "10.0.14393.2007"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1356,
"digest": "sha256:0583adf9c3d3c52a05a131ad1a868c9e61f550e83444f868d66bd83e1125bdc3",
"platform": {
"architecture": "amd64",
"os": "windows",
"os.version": "10.0.16299.192"
}
}
]
}

Windows image compatibility

Windows has specific requirements for creating and running containers across Windows versions. For more details see Microsoft’s documentation on container version compatibility. If you are running Windows 10 Insider builds make sure to verify what images will be compatible with your Windows version. Microsoft provides Insider versions of Windows base images on Docker Hub, such as microsoft/nanoserver-insider, with tags for the appropriate Insider build.

Note that manifest lists also allow authors to create images that can run on different Windows versions without requiring explicit tags to be maintained and specified by users. The two Windows entries in the hello-world manifest are an example: one for Windows 10 1607 (10.0.14393) and one for Windows 10 Fall Creators Update (10.0.16299).

Going forward

The LCOW feature is under active development:

If you build something cool let us know on Twitter!

, ,

Carl Fischer

Docker for Windows Desktop 18.02 with Windows 10 Fall Creators Update


3 Responses to “Docker for Windows Desktop 18.02 with Windows 10 Fall Creators Update”

  1. ionut

    That's great news! Can't wait to test it! Though, I have a question: How can I use this approach within docker-compose context?

    Reply
  2. Carl Fischer

    Glad to hear it! docker-compose 1.20 should have experimental support for the –platform flag via https://github.com/docker/docker-py/pull/1856 and https://github.com/docker/compose/pull/5631

    Reply
  3. sharky

    Has this function been pulled?

    docker -v
    Docker version 18.03.0-ce-rc4, build fbedb97

    docker run –rm –platform linux busybox echo hello
    PS C:\Users\Administrator> docker run –rm –platform linux busybox echo hello
    Unable to find image 'busybox:latest' locally
    C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid platform: invalid platform os "linux".
    See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run –help'.

    Reply

Leave a Reply

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.