Getting Docker running on my windows system

Posted by: Glavs Blog, on 10 Dec 2015 | View original | Bookmarked: 0 time(s)

Intro

This post is about some of the issues I had installing the latest docker toolbox and how I went about solving them to be able to finally get docker working on my windows system.

For those not familiar with docker and what it is/does, I suggest going here and reading up on it a bit.

For the record, I have a fairly standard Windows 10 laptop, which was upgraded from Windows 8.1. Gigabyte P34v2 with 16Gb of memory and a 256Gb SSD. Nothing special.

Installing docker

Twitter kindly informed me of a great blog post by Scott Hanselman around "Brainstorming development workflows with Docker, Kitematic, VirtualBox, Azure, ASP.NET, and Visual Studio" so I decided to follow the steps and give it a shot.

I started following the steps involved, although I initially missed the part about disabling Hyper-V. So disable Hyper-V and then reboot. If you are doing Cordova/Ionic development and using some of the emulators accompanying visual studio that require Hyper-V, this may be somewhat inconvenient for you.

Everything seemed to initially install fine. Docker installed all of its components including VirtualBox.

Next step is to double click the 'Docker Quickstart terminal' to ensure everything is installed as expected.

Problem 1: Docker virtual machine will not start.

Docker terminal starts up and begins setting up the environment (creating SSH keys etc), creating the virtual machine within VirtualBox and starting that machine. However, the virtual machine simply would not start and the docker terminal reported the error and stopped.

I loaded up KiteMatic which is the other utility application that the Docker toolbox installs to see if that could help. It has an option to delete and re-create the VM. So I went and did that, but to no avail. The VM gets deleted, recreated but will not start.

I tried uninstalling and re-installing the docker toolbox, realised the VM remains in VirtualBox, so deleted that VM manually (it was named default), then un-installed and re-installed again but unfortunately no go.

I loaded VirtualBox and tried to start the machine manually but no go. A dialog was shown with a 'Details' button which revealed the following error:

Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' (VERR_INTNET_FLT_IF_NOT_FOUND).

Hmm, not that informative but plonking the error code into google/bing revealed many posts of others having similar issues.

Seems that the issue was within VirtualBox itself (note: I had version 5.0.10) and that any virtual machine that had a Host-only network defined for that VM simply will not start. When the docker toolbox is installed it creates a virtual machine (typically named default) and also sets up a Host-only network adapter to allow the client tools to communicate with the VM. In addition, un-installing and re-installing the docker tools can create multiple instances of the Host-only adapter. I tried using a few variants but to no avail. it simply would not start.

Vbox-VM-Settings

It seemed it was some networking issue with the VM setup. I had originally though it was related to bridged connections on my windows box. I had tweeted as much and Scott Hanselman suggested I run:

netcfg d

which performs a cleanup of your network devices. I did that and not much changed. I did it again and it wiped out every network connection I had. Oh yes, wireless, ethernet all gone. I deleted the adapter from device manager and let windows rediscover my network devices. Small tip: Dont do this. Obviously Scott was trying to be helpful and I was blindly trying to get things working.

After much searchng I stumbled upon this thread which describes the problem I was having. Essentially, when VirtualBox installed under Windows 10 (I dont know if this happens with all Windows 10 instances but it definitely happens some, also to some Windows 7 or 8 instances) but it uses the NDIS6 network driver. This is the main issue.

A resolution is easy enough in the form of installing VirtualBox via the .MSI file with an explicit command line parameter to use the NDIS5 driver on installation. The line below shows how you can do this:

VirtualBox-5.0.4-102546-Win -msiparams NETWORKTYPE=NDIS5

So, once this was done, I could manually start the default docker VM. I did a re-install of the docker tools and tried starting the docker quickstart terminal.

Problem 2: Docker toolbox installs but does not communicate with the Docker VM

The docker quickstart terminal starts up, checks for the existence of the VM, starts the VM, then tries to things around certificate generation, SSH communication, and determining the IP address of the docker VM. I was getting failures of varying types such as errors with SSH comms, or Maximum retries exceeded (5). These channged as I did various attempts at uninstalling and re-insllation of docker toolbox.

The errors I was seeing eventually led me to the solution but there was also a bunch of other solutions to these issues but where others had different root causes.

The eventual solution was in the IP config of the Host-only adapter. When installing the docker toolbox, there were times where DHCP was not enabled and different IP settings were used. In the end, I manually altered the IP settings to use the configuration in the images below. Note: In VirtualBox, you can get to the configuration of the adapters by going to File > Preferences and selecting Network.

VBox-HostOnly-Settings-tab1

VBox-HostOnly-Settings-tab2

As long as the subnet is correct and the range of IP addresses is correct, you should be good and I imagine a number of varying configurations would work here.

Now starting the docker quickstart terminal located the VM, started it AND communicated with it!

docker-startup

Woohoo. not.

Problem 3: Docker command not recognised at the command prompt.

I was done, or so I thought. Typing in docker at the command prompt yielded a:

bash: docker: command not found

So close.

I had thought somehow the tools were not correctly installed, tried another un-install and a re-install. No go.

Looking in c:\Program Files showed that the docker toolbox had been created and all the tools were in fact in there. However, even uninstalling and re-installting the tools did not set the path correctly so I ended up adding C:\Program Files\Docker Toolbox to the global PATH environment variable manually and now typing docker yielded a help listing showing the options available to the docker command.

Are we there yet?

The final test is to try and run the hello world basic container via:

docker run hellow-world

Problem 4: DNS Failure locating docker images.

So I got this error message when tryng to run the hello world container:

DNS fails on image pull: dial tcp: lookup index.docker.io

I must admit, at this point I am thinking I could have had a more productive time inventing a new javascript framework but I have come this far. So, a little more google/bing fu and I came across this post that did the trick.

Essentially, what I needed to do was:

  1. Load Kitematic and once started, click on the Docker CLI as mentioned in the post.
  2. Type in docker-machine ssh default (where default is the name of my docker VM)
  3. Then type echo "nameserver 8.8.8.8" > /etc/resolv.conf

Boom

And that, ladies and gentlemen worked as expected. Now I am truly done and have been playing with containers on windows ever since.

docker-working

Hopefully this post has been a little helpful and saved someone a heap of time.

Category: Visual Studio | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 422 | Hits: 8

Similar Posts

  • My History of Visual Studio (Part 7) more
  • How to retire (respectfully) legacy systems more
  • Working on Silverlight .NET RIA Services Part 2 more
  • Open SQL Port for specific IP by ASP.NET Website more
  • Update to Logging in to DotNetNuke from a Silverlight Application with RIA Authentication more
  • SQL 2008 CLR Triggers, use a .NET class library in SQL using WPF more
  • Logging in to DotNetNuke from a Silverlight Application with RIA Authentication more
  • WSE, DIME; WCF, MTOM; OH My! more
  • Getting better performance in web apps with a few lines of script more
  • Exposing Custom WCF Headers through WCF Behaviors more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD