I am trying to run Docker Desktop as a service on a Windows machine. The idea is to use the Windows machine as a Jenkins slave in which Docker containers can be started. I succesfully managed to add Jenkins to the list of services. Running Docker, however, as a Windows service does not seem to work.
The system has following specifics:
- Windows 10 Build 18363.1016
- Docker version 19.03.12
I tried following steps:
- Install Docker on Windows
- After this installation, following Docker service is present when inspecting the list of services in the 'Services' application on windows, as can be seen in this picture. This service, however, does not run the Docker daemon, as following error arises in Jenkins at this point:
docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/containers/create: 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.. - Above error can be resolved by logging in on the Windows machine, and manually starting the Docker Desktop application. However, as the goal is to make this login step unnecessary, we would like to start the Docker Desktop application, i.e. the Docker daemon, using a Windows service. This is done by by using following command in the Windows Powershell:
SC.exe CREATE Docker Displayname= "Docker" binpath= "C:\Program Files\Docker\Docker\Docker Desktop.exe" start= auto. This command is successfully executed. - Above step results in the listing of the newly created Windows service in de Services application. This service, however, fails to run on Windows startup, and when manually trying to start this service, following error output is obtained:
Windows could not start the Docker service on Local computer. Error 1053: The service did not respond to the start or control request in a timely fashion..
I tried following steps to resolve above problem, but none lead to a working solution:
- Change the Windows timeout settings through Registry, by adding a key called
ServicesPipeTimeout. - Try to call a different Docker binary located within
C:\Program Files\Docker\Docker.
I did find indications online that it should be possible to run Docker as a Windows service, e.g. on this Github page, but probably I am missing something. Did anybody else run into this problem, and how can it be fixed?
Thanks for the help in advance.