Open x-0D opened 4 months ago
I tried this after seeing you post. If you have Rancher Desktop installed the docker cli is available at /mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/
and the docker socket is at /mnt/wsl/rancher-desktop/run/docker.sock
.
You can connect by
/mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/
to your PATHunix:///mnt/wsl/rancher-desktop/run/docker.sock
/mnt/wsl/rancher-desktop/run/docker.sock
to your userEverytime rancher restart the permissions on /mnt/wsl/rancher-desktop/run/docker.sock
will reset.
I am using home-manager so I put this in my configuration
home.sessionVariables = {
DOCKER_HOST = "unix:///mnt/wsl/rancher-desktop/run/docker.sock";
};
home.sessionPath = [
"/mnt/c/Program Files/Rancher Desktop/resources/resources/linux/bin/"
];
home.packages = [
(pkgs.writeShellScriptBin "rancher-desktop" ''
echo "starting rancher.."
/mnt/c/Program\ Files/Rancher\ Desktop/Rancher\ Desktop.exe&
echo "setting permissions.."
sudo chown nixos:users /mnt/wsl/rancher-desktop/run/docker.sock
echo "done!"
'')
]
It's a little clunky, but it seems to work. I haven't tested it thoroughly.
Another workaround is to add PATH=$PATH:/run/current-system/sw/bin/
at the beginning of:
C:\Program Files\Rancher Desktop\resources\resources\setup-spin
The write protection needs to be removed before the file can be edited. Afterwards enabling the integration should work the same as with other distros. This should probably be reported to the Rancher Desktop repo and fixed there.
Credit: https://github.com/sonowz/vscode-remote-wsl-nixos/blob/master/server-env-setup
Problem
Rancher desktop integration don't work with nixos distro
Solution
Add support for rancher-desktop integration optional feature flag