Skip to content

v-anshie/docker-windows-box

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-windows-box

This is a Vagrant box to test Windows Docker Containers on a Windows Server 2016. 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.

After provisioning the box has the following tools installed:

  • Windows Server 2016 with Docker Engine CS 1.12 and client
  • docker-machine 0.8.2
  • docker-compose 1.9.0-rc1
  • (Docker Tab completion for PowerShell (posh-docker))
  • Chocolatey
  • Git command line
  • Git Tab completion for PowerShell (posh-git)
  • SSH client

Optionally you can create a Hyper-V Docker Linux machine and have a multi architecture experience in one VM.

Tested with Vagrant 1.8.1 (not 1.8.4), VMware Fusion Pro 8.5.0 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...

Get the base box

First register to evaluate Windows 2016, but you don't need to download the ISO manually.

For the next step you need Packer. You have several ways how to install it. The easiest way is to install it via Homebrew. After you have installed Homebrew. Run the following command when you installed Homebrew:

brew install packer

If you don't have the Vagrant windows_2016_docker base box you need to create it first with Packer. See my packer-windows repo to build the base box.

To build the base box you have to run these commands on your host machine:

git clone https://github.com/StefanScherer/packer-windows
cd packer-windows
packer build --only=vmware-iso windows_2016_docker.json
vagrant box add windows_2016_docker windows_2016_docker_vmware.box

Spin up the box

To start the VM with Vagrant run this command

vagrant up

You only have to logout and login once to have the Docker tools in user vagrant's PATH.

Create some Windows Docker Container images

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.bat

Test the nightly Windows Docker Engine

You can update the Docker Engine with the script

C:\update-container-host.ps1

This will stop the Docker service, download the nightly build from https://master.dockerproject.org and restart the service.

Create a Linux Docker machine in Hyper-V

If you want to try out multi architecture you also use docker-machine to 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.

C:\vagrant\scripts\create-hyperv-linux-docker-machine.ps1

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.

Use the Linux Docker machine

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

Windows Docker Swarm demo

See subdirectory swarm-demo

Use Vagrant to control your box

From your host control your Vagrant box with the usual Vagrant workflow:

  • vagrant up
  • vagrant halt
  • vagrant destroy -f
  • vagrant snap take
  • vagrant snap rollback
  • ...

Writing the installation script for the Hyper-V Docker machine the snapshot functions helped me a lot to test the script again and again.

About

Vagrant box with Windows Server 2016 and Docker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PowerShell 73.0%
  • Ruby 24.5%
  • Shell 2.5%