rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.73k stars 271 forks source link

Register Rancher Desktop as a windows service #7156

Open skyhirider opened 1 week ago

skyhirider commented 1 week ago

Problem Description

I would like to be able to run Rancher Desktop as a service on a Windows system, making it automatically start up and run containers (that are set up to always run) without needing to log into the system as the user that installed Rancher.

My use case is I need to set this up on a multi user Windows machine where containers need to auto start after a system reboot without any action from my side.

Proposed Solution

Add a similar command that docker has "dockerd.exe --register-service", ideally also add a UI checkbox that can be enabled for Rancher Desktop to set the service up.

Additional Information

It seems Docker Desktop can run as a service on a Windows system via dockerd.exe --register-service , if the feature already exists in Rancher Desktop I was not able to find documentation.

If there is a way set up containerd or moby to run this way, adding it to Rancher documentation would help as well.

mook-as commented 1 week ago

Unfortunately, last time I checked, WSL needed to be run as the user. So we'll need to be in the context of the user to work at all.

Does the dockerd.exe --register-service command work with the WSL2 Docker Desktop backend, or the Hyper-V (or even the Win32) one? I wasn't able to locate its documentation with a quick search…

skyhirider commented 1 week ago

When searching, I found this mention of it https://github.com/moby/moby/issues/27696

Will see if I can test how this is actually set up in Docker, but my first choice was using Rancher Desktop

jandubois commented 1 week ago

I believe dockerd.exe --register-service runs the server in Windows mode, not Linux. So you will only be able to run Windows containers in this configuration.

Note that Rancher Desktop does not support running Windows containers, so if that is your use-case, then Rancher Desktop will not work for you, regardless of the service config.

As @mook-as already mentioned, I can only see Docker Desktop potentially running Linux containers without being logged in when using the legacy Hyper-V backend, but don't know if they actually support it or not.