Issue:
Failed to start the Docker Engine Service with error “start-service : Failed to start service ‘Docker Engine (docker)'”
Description
- Using Kubernetes (Orchestrators) to collect Analytic data from Windows Container host with Azure Monitor
- Configure Docker Engine service using daemon.json file and Windows Registry to collect Analytical data from the Windows Containers
Symptoms
- Added parameter, ‘tcp://0.0.0.0:2375′ was added to the daemon.json file and Windows Registry
- Failed to start Docker Engine service with error: start-service : Failed to start service ‘Docker Engine (docker)’.
- Unable to get Docker Version details with docker version command with error:
Error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Summary
- Configure the Docker service
Article followed: https://docs.microsoft.com/en-us/azure/azure-monitor/insights/containers#install-and-configure-windows-container-hosts
Stop-Service docker
dockerd –unregister-service
dockerd –register-service -H npipe:// -H 0.0.0.0:2375
Start-Service docker
{ “hosts”: [“tcp://0.0.0.0:2375”, “npipe://”] }
- Configure Docker on the Docker service
Article Followed: https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon
sc config docker binpath= “\”C:\Program Files\docker\dockerd.exe\” –run-service -H tcp://0.0.0.0:2375″
PS C:\> start-service docker
PS C:\> stop-service docker
PS C:\> dockerd –unregister-service
PS C:\> dockerd –register-service -H npipe:// -H 0.0.0.0:2375
PS C:\> 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
Cause
The parameter, ‘tcp://0.0.0.0:2375′, only needs to be in one place, either the daemon.json or registry using sc config command. If the parameter is set in both places the Docker service will fail to start
Solution
Either use the -H switch when registering the service or in the daemon.json. It’s one of the other but not both.
Stop-Service docker
dockerd –unregister-service
dockerd –register-service -H npipe:// -H 0.0.0.0:2375
Start-Service docker
Configure Docker with the configuration file for TCP pipe and named pipe
{ “hosts”: [“tcp://0.0.0.0:2375”, “npipe://”] }
OR
Stop-Service docker
dockerd –unregister-service
dockerd –register-service -H npipe:// -H 0.0.0.0:2375
Start-Service docker
Configure Docker with the configuration file for TCP pipe and named pipe
{ “hosts”: [“tcp://0.0.0.0:2375”, “npipe://”] }