Various Vagrant envs with Windows 2019/10 and Docker, Swarm mode, LCOW, WSL2, ...
This repo is a collection of various Vagrant environments to work with Windows Containers on a Windows Server 2019 or Windows 10 VM.
There are different Vagrantfiles for each scenario:
Vagrantfile- Windows Server 2019 and Docker 18.09.0
lcow/Vagrantfile- Windows 10 with nightly Docker and LCOW enabled
nano/Vagrantfile- Test setup to have Docker engine installed in a Windows Nanoserver VM
swarm-demo/Vagrantfile- some Windows Server 2016 VM's in classical Docker Swarm
swarm-mode/Vagrantfile- some Windows Server 2016 VM's in Docker Swarm-mode and overlay network
windows10/Vagrantfile- Windows 10 1809 and nightly Docker to test process isolation
This repo has started with a single Vagrantfile that is explained below. As you can see there are several interesting setups here as well in the sub folders.
Have a look at my blog posts how to Setup a local Windows 2016 TP5 Docker VM and Adding Hyper-V support to 2016 TP5 Docker VM for more details. I also can recommend a more up to date guide Getting started with Windows Containers by @glennsarti
After provisioning the box has the following tools installed:
Optionally you can create a Hyper-V Docker Linux machine and have a multi architecture experience in one VM.
Tested with Vagrant 2.1.2, VMware Fusion Pro 10.1.3 on a MacBookPro with Retina display. The Vagrant box will be started in fullscreen mode also with Retina support.
You can learn and play a lot of scenarios with it:
Future work will be a Docker Swarm with both Linux and Windows Docker Engines...
First register to evaluate Windows 2019, but you don't need to download the ISO manually.
The Vagrant base box is available in Vagrant Cloud https://app.vagrantup.com/StefanScherer, these are all eval versions of Windows Server 2019 or Windows 10.
Vagrant will download the base box if it's not available locally, a
vagrant box listshows which boxes you already have downloaded.
As we need to reboot the VM once during the provisioning, you will need an additional Vagrant plugin
vagrant plugin install vagrant-reload
To start the VM with Vagrant run this command
You only have to logout and login once to have the Docker tools in user vagrant's PATH.
You may clone my dockerfiles-windows repo and create some container images.
git clone https://github.com/StefanScherer/dockerfiles-windows cd dockerfiles-windows cd node .\build.ps1
You can update the Docker Engine with the script
This will stop the Docker service, download the nightly build from https://master.dockerproject.org and restart the service.
If you want to try out multi architecture you also use
docker-machineto create a Linux Docker Engine running in Hyper-V. I have prepared a script that will set up everything as there are some known issues.
This PowerShell script creates a Docker machine and updates Docker Engine to the latest so that the Windows Docker client is able to communicate with the Linux Docker Engine.
Open a PowerShell terminal as an administrator and select the Linux Docker machine with
docker-machine env --shell powershell | iex
Now run your first busybox container with
docker run -it busybox uname -a
See subdirectory swarm-demo
From your host control your Vagrant box with the usual Vagrant workflow:
Writing the installation script for the Hyper-V Docker machine the snapshot functions helped me a lot to test the script again and again.