Getting Docker running on my windows system

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: Don’t 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 don’t 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.

4 Comments

  • This is a great blog! Thank you!

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

    Solved my motherfucking issue!

  • Thanks for help!

  • Thanks a lot for your excellent article. This really helped me to solve my issue in windows.
    I spent almost a day trying to get it working and your instructions helped me a to resolve the issue.
    I installed VirtualBox VirtualBox-5.0.12-104815-Win with the option VirtualBox-5.0.12-104815-Win.exe -msiparams NETWORKTYPE=NDIS5
    I installed Docker latest ToolBox DockerToolbox-1.9.1i.exe
    All good on "my machine" now
    Thanks
    Suresh

  • In fact, we are all faced with vents on the streets of the city, which are located under these manholes. Or it is the same distribution box, for example, in the municipal sewage network, to transfer the sewage of the houses to the main sewage network, manholes are placed. It is used in such a way that it connects several sewage pipelines to each other and directs them in one direction. Manhole valves are produced in different sizes and they are used in underground lines and telecommunication lines.

Add a Comment

As it will appear on the website

Not displayed

Your website