Giter VIP home page Giter VIP logo

docker-windows-box's Introduction

docker-windows-box

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:

Introduction

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:

  • Windows Server 2019 with Docker Engine 18.09.0 and client
  • docker-machine 0.16.0
  • docker-compose 1.23.0
  • (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 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...

Get the base box

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 list shows which boxes you already have downloaded.

Install Vagrant reload plugin

As we need to reboot the VM once during the provisioning, you will need an additional Vagrant plugin

vagrant plugin install vagrant-reload

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

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.

docker-windows-box's People

Contributors

9034725985 avatar cliv avatar minimonium avatar patricklang avatar solidnerd avatar stefanscherer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-windows-box's Issues

Kubernetes?

I would love to have/see an easy Windows environment for a Kubernetes cluster as simple as vagrant up. :-)

VMWare-iso with packer build fails

Forgive me if this is too basic but I am very new to 'packer' and VMWare. I am trying to build a VM with docker by following the example given and I get to the second step
packer build --only=vmware-iso windows_2016_docker.json
and I get the error
vmware-iso output will be in this color.

Build 'vmware-iso' errored: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:

  • Fusion application not found at path: /Applications/VMware Fusion.app
  • Fusion application not found at path: /Applications/VMware Fusion.app

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Failed creating VMware driver: Unable to initialize any driver for this platform. The errors
from each driver are shown below. Please fix at least one driver
to continue:

  • Fusion application not found at path: /Applications/VMware Fusion.app
  • Fusion application not found at path: /Applications/VMware Fusion.app

From the looks of it it looks like I am missing VMWare or Fusion or both. Would you guide me on how to install these also on my MAC?
Thank you.

Kevin
[email protected]

different vagrantfile

Great work on the box! It's very helpful for getting windows docker running on linux.
I've noticed however that your latest vagrant repo is behind this git hub repo. The vagrantfile vagrant pulls does not have vram, clipboard etc mods for virtualbox.

Command seen stuck when tried to execute -H tcp://containerIP:2375 between Nodes

I am adding this new issue based on the prior discussions I had with Stefan Scherer.

Problem Description:
When I was trying to run the swarm demo as instructed in the link "https://stefanscherer.github.io/build-your-local-windows-docker-swarm/" and I got stuck in one of the steps, mainly when I tried to fetch the token from swarm manger from a node (window node), docker-swarm-join script was seen stuck for sometime and exited with error. Later I found that docker -H tcp://192.168.36.2:2375 is not working when I tried it from my worker node. But I am able to run this command from my real machine, and the manager node vm is returning me the token. With this token, i am able to join the swarm from all nodes created. I am not sure why I can't use this command from the VMs, I believe vms can see each other on the network that is why I am able to join swarm, and was able to run a service on nodes, right?.

Also, I ran the portainer application using the script given in the sample to view the swarm, but I was not able to view it using the browser using http://192.168.36.2:9000/ . Browser says it can't find the server. Even I couldn't connect it from my real machine

This is how the docker service is registered currently
.dockerd.exe --run-service -H npipe:// -H 0.0.0.0:2375 -G docker --label os=windows

My host machine is Windows 10 1607. We are using oracle virtual box with docker-windows base image from Windows2016 server trial version. There is corporate proxy which we had already set and we can pull images and we had set the DNS same as our corporate DNS.

Pinging between the nodes was only enabled after I set the ICMP. Even disabling the firewall or writing inbound and outbound rule is not helping us.

Blank black screen with cmd only

I managed to get vagrant up to complete successfully with no errors.. but once its up and running its just a black window with a single cmd open?

Am I missing something? Should there not be a UI version with windows bar etc?

image

Dependencies

Probably worth adding to the readme that docker-windows-box is dependent on:

  • VMware Player
  • VMware Vix (for vmrun command)
  • vmware-vdiskmanager command (which I'm not sure where the proper place to download that)

Modify packer to use iso file

The packer build process takes a long time for me and one way to speed things up would be to use an existing iso file. But being unfamiliar with 'packer' I am not sure how to modify the build script to do so.

Not really an issue - But missing item in pre-req

Hello, I just wanted to point out that it would be great to add in the readme pre-requisites to include that VMWare needs to be installed to run this command: packer build --only=vmware-iso windows_2016_docker.json.

thank you for this project though. this is awesome

[TODO] vmware-iso: Could not find networking conf file: /Library/Preferences/VMware Fusion/networking

after #31 when I run:
packer build --only=vmware-iso windows_2016_docker.json
I get:

==> vmware-iso: Creating floppy disk...
vmware-iso: Copying files flatly from floppy_files
vmware-iso: Copying file: ./answer_files/2016_core/Autounattend.xml
vmware-iso: Copying file: ./scripts/disable-screensaver.ps1
vmware-iso: Copying file: ./scripts/disable-winrm.ps1
vmware-iso: Copying file: ./scripts/docker/enable-winrm.ps1
vmware-iso: Copying file: ./scripts/docker/2016/install-containers-feature.ps1
vmware-iso: Copying file: ./scripts/microsoft-updates.bat
vmware-iso: Copying file: ./scripts/win-updates.ps1
vmware-iso: Done copying files from floppy_files
vmware-iso: Collecting paths from floppy_dirs
vmware-iso: Resulting paths from floppy_dirs : []
vmware-iso: Done copying paths from floppy_dirs
==> vmware-iso: Creating required virtual machine disks
==> vmware-iso: Building and writing VMX file
==> vmware-iso: Could not find networking conf file: /Library/Preferences/VMware Fusion/networking
==> vmware-iso: Deleting output directory...
Build 'vmware-iso' errored: Could not find networking conf file: /Library/Preferences/VMware Fusion/networking

==> Some builds didn't complete successfully and had errors:
--> vmware-iso: Could not find networking conf file: /Library/Preferences/VMware Fusion/networking

==> Builds finished but no artifacts were created.

Docker Daemon ExecStart initial value has changed?

docker-swarm-init.sh isn't working because it expects this:

ExecStart=/usr/bin/dockerd -H fd://

but since recently gets this:

ExecStart=/usr/bin/dockerd -H unix://

Don't know why, but to be sure sed should be fixed to a more general case?

Latest docker

Latest docker would not work due to moby/moby#25176

Need to either reinstall / refresh docker data, or move old graph driver to the new path.

Creating a FS link (joint) will also work.

Update virtualbox fails

Hi, I'm trying to run the VM on Virtualbox, and I'm hitting the below issue:

The URL for the .iso is correct, I can download it on my own machine. In order to get to this point though, I'm hitting issue #15, where the VM gets stuck on Windows updates and eventually times out, leaving the host waiting for winrm to become available. I've killed the windows updates script on the VM and run the enable winrm script manually. It's after this point that it dies.

Error upon vagrant up Mac OSX

Catalina 10.15.4

$ git clone https://github.com/StefanScherer/docker-windows-box.git && cd docker-windows-box

$ vagrant up

==> default: Successfully added box 'StefanScherer/windows_2019' (v2020.02.26) for 'virtualbox'!
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:

  • The 'reload' provisioner could not be found.

How to fix this thanks

I followed the instructions to end up with a vmware box, which I added with vagrant, and can see in list, but can't bring up machine

docker-windows-box master 1d ⍉ ➜ vagrant box list
windows_2016_docker     (vmware_desktop, 0)
windows_2016_tp5_docker (vmware_desktop, 0)
docker-windows-box master 1d ➜ vagrant up      
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'windows_2016_docker' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'windows_2016_docker' (v0) for provider: virtualbox
    default: Downloading: windows_2016_docker
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/patrickscott/dev/winblows/docker-windows-box/windows_2016_docker

Not sure what I'm doing wrong - am I missing something? Thanks in advance if you can help!

Question about overlay network

Hi Stefan,

I'm trying to use your example for some Windows Container stuff at work, I'm having trouble getting a definitive answer on whether routing mesh supported in Windows 2016 yet?

I'm running Docker 17.03.1-ee-3 on Windows Server 2016 (os build 14393.1358).

Thanks for all the work you are doing in this area!

Waiting for WinRM to become available

Packer v0.12.3

PS> packer build --only hyperv-iso -var 'hyperv_switchname=Primary Virtual Switch' -var 'iso_url=C:\Downloads\14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO' .\windows_2016_docker.json

This runs then hangs at:

==> hyperv-iso: Waiting for WinRM to become available...

The Autounattend.xml has not been modified.

Windows 10 and Windows Remote Management service is Running (Automatic).

I doubt this is a problem with the scripts as provided but I don't know where to begin fixing this.

Problem using your docker-windows-box

Hello
i'm getting an error ..
➜ windows-docker-machine git:(master) vagrant box add windows_2016_docker_virtualbox windows_2016_docker_virtualbox.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'windows_2016_docker_virtualbox' (v0) for provider:
box: Downloading: windows_2016_docker_virtualbox.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/ybello/windows-docker-machine/windows_2016_docker_virtualbox.box

i also verify that big *.box file is in the packer-windows directory where it;'s called the packer build command.
-rw-r--r-- 1 ybello staff 5.9K May 13 01:09 windows_2016_docker.json
-rw-r--r-- 1 ybello staff 2.3K May 13 01:09 windows_2016_docker_azure.json
-rw-r--r-- 1 ybello staff 10G May 13 13:58 windows_2016_docker_virtualbox.box
-rw-r--r-- 1 ybello staff 4.3K May 13 01:09 windows_2016_hyperv.json

it's seams there is a problem - can anyone can help ?
also please note that suddenly the new VM inside the virtualbox that was created earlier by the build is despair

please help - i really need this work

thanks

Packer build

Hi Stefan

I am having a few issue when trying to use Packer to build the images for the swarm cluster. It starts to build the Win 2016 gets to the windows updates but if it fails the Virtualbox images just disappears? is there any way to remove the windows update component of the build?

Licensing

I'm trying to figure out whether I can use the Vagrant boxes you've built as input for building a registry disk which can be used with KubeVirt.

I was just wondering whether you have any guidance on the redistribution rights for such disks. The gut feeling says that it's probably fine as long as the image is not activated, but I couldn't find any "official" guidance on this.

Do you happen to know where I can find more information (a statement,...) on this?

vagrant up?

I am new to vagrant and packer so forgive me. I successfully did all four steps mentioned in the README.md.

Now I try 'vagrant up' and get

$ vagrant up
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
$ 

I must have missed a step. Is there any possibility of getting some high-level explanation for the last two steps and what I need to do to be able to run 'vagrant up' successfully.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.