Windows Containers on Windows 10 or 11, without Docker Desktop
By Mark DeNeve
When it comes to running Windows Containers, the only straight forward way to run them has been through Docker Desktop. Starting in August of 2021, the license that Docker Desktop was distributed under changed. It became “Free for personal use” only. If you were using it as a part of your day-2-day job, you were going to need a subscription/license. (see Docker Subscriptions for more details.) But what if you don’t need the fancy UI, and you just want to run Windows Containers on your Windows 10 or 11 host? One option is to download and manually install the Moby binaries from github. If you are looking for a more automated process, Stevedore may be for you.
Stevedore is a simple installer that will install and configure Windows Containers (and ONLY Windows Containers) to run on your Windows 11 Desktop, without the need for “Docker-Desktop.” It uses the upstream Moby Project binaries and installs them in the proper location to make things work. Keep in mind that you will have no support for these binaries other than what you can get from the Moby OpenSource community. If you need support, purchasing a Docker Desktop license is going to be your best route.
NOTE If you are looking to run Linux containers on a Windows machine, I suggest looking at Podman and Podman Desktop. This tool will allow you to easily run Linux containers on a Windows host without the licensing restrictions of Docker Desktop.
Terminology
A quick word about terminology here, because it can get confusing. We will be installing “Little d” docker tools. These should not be confused with “Big D” Docker tools. “Big D” Docker tools are those (like Docker Desktop) that fall under the subscription model outlined earlier. The tools we are installing with Stevedore are “little d docker” as part of the Moby project.
Use Stevedore to install the Windows Container tools
Using Stevedore to install the docker binaries couldn’t be easier. Download the most recent release of the installer from the Stevedore releases site, and run the installer.
Note: This tool will only work for Windows x86-64 based architectures.
When downloading the installer you may be prompted that the file is not frequently downloaded and may not be safe. It is up to YOU to decide if you want to continue with this application or not.
Once you have downloaded the installer, run the installer and ensure that you leave the Hyper-V feature enabled. If you want to build/run Windows containers based on Windows 2019, you will need this feature enabled.
The installer will take some time to install as it needs to install/enable additional Windows features to enable Windows Containers. When the install completes, you will be prompted to reboot your pc.
Validating the install
Once your PC has rebooted, you can test that the container tools have been installed by opening a Powershell prompt and typing docker info
PS C:\ docker info
Client:
Context: default
...
Default Isolation: hyperv
Kernel Version: 10.0 22621 (22621.1.amd64fre.ni_release.220506-1250)
Operating System: Microsoft Windows Version 22H2 (OS Build 22621.1555)
OSType: windows
Architecture: x86_64
...
Product License: Community Engine
The big thing here to note is the Product License: section stating Community Engine. Congratulations, you now have a working install of docker ce, which can run Windows Containers.
Tweaking the docker daemon configuration
NOTE: This section is optional, and only required if you need to make configuration changes to the docker daemon. If you don’t need to make any configuration changes, you can skip to Testing it all works
If you are like me, you may run an internal registry that uses a self signed certificate. In order to tell docker that this is OK, you need to edit the daemon.json
file. But where is this file located? By default, the Stevedore installer does not create this file so the docker daemon is running with all default options. To make configuration changes to the docker daemon create a directory called C:\ProgramData\docker\config
and then create a new file called C:\ProgramData\docker\config\daemon.json
with the following contents:
{
"insecure-registries" : [ "registry.<my domain>:8443" ]
}
With the config file created, you will need to restart the service which has been installed as “stevedore”. Open a PowerShell prompt and run the following command:
PS C:\> Restart-Service -Name stevedore
Testing it all works
We will now run our first Windows Container. We will use the standard “Hello World” container to ensure everything runs properly. To test, run docker run hello-world
from the command line:
PS C:\> docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
Digest: sha256:4e83453afed1b4fa1a3500525091dbfca6ce1e66903fd4c01ff015dbcb1ba33e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
Windows containers are much larger than traditional Linux containers, so you may notice that this takes a few minutes to download/run the first time. Just be patient. If you get “Hello from Docker” you have successfully run a Windows Container.
Test Building
We will conduct two more small tests to ensure that everything is working properly. The first thing is to build a new container. Using your favorite text editor, create a file called “Dockerfile” and paste the following contents into it:
FROM mcr.microsoft.com/windows/servercore:ltsc2022
ENTRYPOINT ["powershell.exe", "-command", "$listener = New-Object System.Net.HttpListener; $listener.Prefixes.Add('http://*:80/'); $listener.Start();Write-Host('Listening at http://*:80/'); while ($listener.IsListening) { $context = $listener.GetContext(); $response = $context.Response; $content='<html><body><H1>Hello from a Windows Container Web Server</H1></body></html>'; $buffer = [System.Text.Encoding]::UTF8.GetBytes($content); $response.ContentLength64 = $buffer.Length; $response.OutputStream.Write($buffer, 0, $buffer.Length); $response.Close(); }"]
This will create a very small Windows based “Web Server” that serves up a page on port 80 that says “Hello from a Windows Container Web Server”.
Now from the parent directory of the file you just created, we will build the container image with the docker build
command:
PS C:\ docker build -t test .
Sending build context to Docker daemon 2.56kB
Step 1/2 : FROM mcr.microsoft.com/windows/servercore:ltsc2022
---> b53d206693f6
Step 2/2 : ENTRYPOINT ["powershell.exe", "-command", "$listener = New-Object System.Net.HttpListener; $listener.Prefixes.Add('http://*:80/'); $listener.Start();Write-Host('Listening at http://*:80/'); while ($listener.IsListening) { $context = $listener.GetContext(); $response = $context.Response; $content='<html><body><H1>Hello from a Windows Container Web Server</H1></body></html>'; $buffer = [System.Text.Encoding]::UTF8.GetBytes($content); $response.ContentLength64 = $buffer.Length; $response.OutputStream.Write($buffer, 0, $buffer.Length); $response.Close(); }"]
---> Running in 40c65453caf5
Removing intermediate container 40c65453caf5
---> c9932c24836f
Successfully built c9932c24836f
Successfully tagged test:latest
With our container successfully built, we can now test it out, including port forwarding by running the following command:
PS C:\ docker run -p 8080:80 --name testserver test:latest
Listening at http://*:80/
Open a web browser and browse to http://localhost:8080 and you should be greeted with the following:
Conclusion
If you are looking for a way to run Windows Containers on Windows 10 or Windows 11, without having to purchase a license for Docker Desktop, or put up with the requirement to frequently update the application, Stevedore is a good option to get the upstream docker tools installed and working.