Category Archives: KB

Unable to Start Docker Service on Windows 2016 TP5

So today i was playing with Docker and Containers on windows 2016 technical preview 5 with the following this guide:

https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_server

I am running this a Virtual Machine in VMware 6 in my demo environment and was now planing ton use hyper-v containers just windows containers as i did not want to get involed with Nested Virtualization.

Every thing work until i try to start docker:

start-docker


PS C:\Users\Administrator> Start-Service docker

Start-Service : Failed to start service 'Docker Engine (docker)'.
At line:1 char:1
+ Start-Service docker
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand

And in event viewer it display this:

Log Name: Application
Source: docker
Date: 23/09/2016 08:44:01
Event ID: 4
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: dockerwinhost
Description:
fatal: Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : Failed to create network
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
 <Provider Name="docker" />
 <EventID Qualifiers="0">4</EventID>
 <Level>2</Level>
 <Task>0</Task>
 <Keywords>0x80000000000000</Keywords>
 <TimeCreated SystemTime="2016-09-23T07:44:01.595966100Z" />
 <EventRecordID>297</EventRecordID>
 <Channel>Application</Channel>
 <Computer>dockerwinhost</Computer>
 <Security />
 </System>
 <EventData>
 <Data>Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : Failed to create network</Data>
 </EventData>
</Event>

When Dockers first starts it try to create a nat network on the 172.16.0.0/12 network.  As my Demo Suite is on the 172.30.0.0 Network this class with  the nat network and cause network not to be created. To fix this Open up two powershell windows (Remember to run as Administrator). In the first windows type:

dockerd -H npipe:// -b "none"

This start docker with no network.Switch to the other power shell windows And type the following command to create a network which is not the 172.16.0.0/12 network

docker network create -d nat --subnet=192.168.0.0/24 --gateway=192.168.0.1 MyNatNetwork

Switch back to the other Powershell windows and close it. On the Powershell which is open type to start docker:


Start-Service docker

You should be able to carry on creating containers, The only problem is that i faced after that is that i could not access the containers using the nat mapping from a remote machone. Hopefully this a bug and fixed in RTM. I could access the container via the NAT IP address directly on the container host. To get the NAT IP address of the container type:


docker inspect "ID or Name of the container"

Again you will need to install firefox/chrome on the server if you trying acess to web application from the the container host.As edge does not seem to install by default in windows 2016 Server.

More info on these bugs see:

https://github.com/Microsoft/Virtualization-Documentation/issues/273