Containers are a clever idea that originated in the Linux arena around 16 years ago. They gained traction at a very slow pace until three years ago, when an open-source project called Docker came out of nowhere and took the tech world by storm.
Containers simplify application development, at least in theory. You can pack a lot into a container: operating system, database servers, an application, and other supporting software. From there, you can deploy the container onto any machine running Docker in just a few simple steps.
The first time you run the software, the relevant parts are downloaded and installed. After that, container deployment is nearly instantaneous. That ease of deployment, along with the ability to debug old versions of software in a library of containers, are just two reasons to embrace containers as part of the development process.
Until very recently, the benefits of containers were restricted to Linux developers; containers started out as BSD jails, Solaris Zones and Unix Chroot.
Microsoft took an interest in Docker a couple of years ago, but the only way you could run Docker on Windows was via a virtualized environment under VirtualBox. Now that’s changing. Microsoft Server 2016 will reportedly include containers that will allow native operation; a future build of Windows 10 will also feature containers. If you’re a member of the Windows Insider Program, you can try out Windows 10 containers from build 14352 and up.
The Docker Windows Server Containers (WSC) require Windows APIs of a host Windows kernel. On Windows, Docker is run as a Windows service. This is a bit different than Docker Hyper-V (HVC) Containers, for example, which run each container in a virtual machine, with the host kernel not shared with the HVCs. WSCs share a kernel with the container host and all containers running on that host.
When I first installed the GUI version of Windows server, I got the Docker service working but couldn’t obtain the WindowsServerCore, which is a vital part of a container. Save yourself a lot of time and install the non-GUI version of Windows (more on this below).
Running Docker on Windows Server 2016 Beta
Microsoft has a beta of Windows Server 2016 that’s worth trying out. You have to choose the server type before the download; I went with the Windows Server Containers version. It’s a 4.8 GB download but actual installation (under VirtualBox) is fast. (Hyper-V is a smaller download, if you’re keeping score at home.)
Microsoft has already put up preliminary but useful information about installing the platform. Here’s the quick version:
Given how you need to install the software via Windows PowerShell, type ‘powershell’ at the command line (once you’re running as an Administrator). After that, you’ll need to install:
- The container feature
- Base Container Images
The Windows Server page gives a good rundown of the actual commands needed for all those. After setting the path and restarting, don’t forget to close PowerShell. At this point, you can begin kicking the tires on your container image.
Microsoft did say in late May that they would try and tweak PowerShell so users could view Docker containers. Now there’s an Alpha build available; if you check it out, please note that this is bleeding-edge stuff, not to be used in production (but it is instructive to test out). It contains a PowerShell Module for the Docker Engine, as well as an alternative to the Docker command line that can target a Docker daemon running on any operating system that supports Docker, including both Windows and Linux.
After the GUI failure, I did a bit of searching and found this alternative, which also failed when I ran c:\ContainerSetup.ps1. The person writing that documentation did mention that the GUI version of Windows server didn’t work for him. Still looking for a solution, I went back and reinstalled the command-line version of Windows Server from the 4.8 GB ISO file I’d downloaded earlier; that took under two minutes to install:
This time, everything worked. The instructions were the same, and the lack of a GUI necessitated a lot of careful typing (unless you can get VirtualBox Copy/Paste working). The Install-Container Image command fetches a very large .wim file, several GB in size, so you’ve time to watch a TV show or eat a meal while it downloads.