OneGet / MicrosoftDockerProvider

Provider to search, save and install Docker
Other
133 stars 55 forks source link

Docker does not start after reboot #8

Closed StefanScherer closed 7 years ago

StefanScherer commented 7 years ago

I've tried the installer on Win2016 Eval and rebooted. After the reboot the Docker service is not running (ok, there was a warning about starting it manually). I just wonder why this happens because the Service has start type automatic.

I have tried the Debug-ContainerHost.ps1 script, but this does not retrieve event logs:

PS C:\Users\vagrant> docker version
Client:
 Version:      1.12.2-cs2-ws-beta
 API version:  1.25
 Go version:   go1.7.1
 Git commit:   050b611
 Built:        Tue Oct 11 02:35:40 2016
 OS/Arch:      windows/amd64
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/version: open //./pipe/docker_engine: The system cannot find the file specified.
PS C:\Users\vagrant> wget https://github.com/Microsoft/Virtualization-Documentation/raw/master/windows-server-container-tools/Debug-ContainerHost/Debug-ContainerHost.ps1 -UseBasicParsin | iex
Checking for common problems
                                                            Describing Windows Version and Prerequisites
 [+] Is Windows 10 Anniversary Update or Windows Server 2016 810ms
 [+] Has KB3192366, KB3194496, or later installed if running Windows build 14393 247ms
 [+] Is not a build with blocking issues 36ms
Describing Docker is installed
 [+] A Docker service is installed - 'Docker' or 'com.Docker.Service'  110ms
 [-] Service is running 208ms
   Expected: {Running}
   But was:  {Stopped}
   28:         $service.Status | Should Be Running
   at <ScriptBlock>, <No file>: line 28
 [+] Docker.exe is in path 1.23s
Describing User has permissions to use Docker daemon
 [+] docker.exe should not return access denied 61ms
Describing Windows container settings are correct
 [+] Do not have DisableVSmbOplock set 50ms
 [+] Do not have zz values set 33ms
Describing The right container base images are installed
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/images/json: open //./pipe/docker_engine: The system cannot find the file specified.
 [-] At least one of 'microsoft/windowsservercore' or 'microsoft/nanoserver' should be installed 127ms
   ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
   ParameterBindingValidationException: Cannot validate argument on parameter 'Property'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
   at <ScriptBlock>, <No file>: line 76
Warnings & errors from the last 24 hours
PS C:\Users\vagrant>

Looking into the Application event logs I found these two errors from docker:

The description for Event ID 1 from source docker cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Resolver Setup/Start failed for container none, "json: cannot unmarshal array into Go value of type hcsshim.HNSNetwork"

and

The description for Event ID 4 from source docker cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : Incorrect function. 
StefanScherer commented 7 years ago

Some more infos. After staring the docker service manually I still have unusual event log entries. Seems like the Event Viewer does not know where to get the correct event log messages. (The description for Event ID 1 from source docker cannot be found.).

Seems there is missing an entry for docker in HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application.

The description for Event ID 1 from source docker cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Resolver Setup/Start failed for container none, "json: cannot unmarshal array into Go value of type hcsshim.HNSNetwork"

On another machine I found the entry:

bildschirmfoto 2016-10-14 um 11 00 16
rs38 commented 7 years ago

just tested it on 2016 Eval RTM Nano: I had to start the BitsonNano.exe before, import the module, all went through like a charme and after reboot I did not have to register or start a service!

PatrickLang commented 7 years ago

@StefanScherer any chance your machine has a 172.x.x.x IP address? I think the service failed to start due to a HNS problem and that's a common cause.

StefanScherer commented 7 years ago

@PatrickLang That's possible. I'll check tomorrow and test again.

StefanScherer commented 7 years ago

@PatrickLang Indeed, I accidentally used 172.16.32.x as the internal vCloud app network. I was able to install Docker in an unattended way with these steps

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Force
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Set-PSRepository -InstallationPolicy Untrusted -Name PSGallery
Restart-Computer -Force

Docker is up and running after the reboot.

StefanScherer commented 7 years ago

PS: Working on a way to use this package in my packer template https://github.com/StefanScherer/packer-windows/pull/17

jimmymain commented 7 years ago

Could you explain the problem with a 172... ip address. I have the same problem and a 172... address, but the vEthernet (DockerNAT) adapter is set to 10.0.75.1, so I can't see that there's any kind of conflict. What steps can I take to resolve this?

kallie-b commented 7 years ago

@jimmymain

So, when the Docker engine is first run on your host it creates a default NAT network with internal IP prefix 172.16.0.0/12. Container endpoints are then automatically attached to this default network, and assigned an IP address from its internal prefix. A problem arises when your container host is in the same IP prefix (172.16.0.0/12)—there is then a conflict between your host and internal prefixes.

You can resolve this be changing the NAT internal IP prefix. To do that, follow these steps:

  1. Stop the docker service: stop-service docker
  2. Remove the existing NAT network that Docker created by default: Remove-ContainerNetwork nat 3. In your Docker daemon file (C:\ProgramData\Docker\Config\daemon.json), add an entry for fixed-cidr: “a.b.c.d/x”
  3. Start the docker service: start-service docker

For example, as a result of this change your docker daemon file may look like this:

 {
     "hosts":  [
                  "npipe://"
                   ],
     "fixed-cidr":  "204.17.5.0/24"
}
jayshah-msft commented 7 years ago

Thanks @kallie-b for the info. Appreciate it.

Cheers, Jay!