https://rancher.com/ logo
Title
b

broad-train-31975

04/04/2023, 4:49 PM
Getting the following error when Rancher Desktop is about to ask for sudo password:
at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: `cd "/home/ubuntu"; "/usr/bin/pkexec" --disable-internal-agent /bin/bash -c "echo SUDOPROMPT; /bin/sh -xec 'ln -sf \\"/home/ubuntu/.rd/docker.sock\\" \\"/var/run/docker.sock\\"'"`
}
Running Rancher Desktop on headless (i.e. no UI) Ubuntu 20.04 server, displaying Rancher Desktop UI on MacOS using XQuartz. @fast-garage-66093
f

fast-garage-66093

04/04/2023, 4:55 PM
How do you start the application? I would avoid the
sudo
prompt by running without admin access, i.e.
rdctl start --application.admin-access=false ...
You will not get the
/var/run/docker.sock
endpoint if you are using moby, so you may need to run
docker context use rancher-desktop
b

broad-train-31975

04/04/2023, 4:56 PM
I can try that, but I need docker socket
f

fast-garage-66093

04/04/2023, 4:58 PM
Either set the docker context, or
export DOCKER_HOST=unix:///home/USERNAME/.rd/docker.sock
But if you are using context-aware clients, then setting the context is probably better, so you don't have to worry about propagating the env variable
I guess in a headless env everything is a subprocess, so it may not matter either way
b

broad-train-31975

04/04/2023, 5:04 PM
@fast-garage-66093 you just made my day! Everything started, and after that, I was able to run docker context use rancher-desktop and can see running containers with docker ps. Now, given that this is a Jenkins agent/worker, and largely must run unattended, including that it can restart at any moment, what would you recommend? I remember, since v1.8.1 Rancher Desktop can start automatically, and I can add a service that sets docker context after Rancher Desktop started and initialized
f

fast-garage-66093

04/04/2023, 5:05 PM
In meetings now...
b

broad-train-31975

04/04/2023, 5:07 PM
no worries, but if you get some ideas, get back to be when you have time we can use a systemd service (I have some experience) to completely automate this and not need UI at all - maybe
f

fast-garage-66093

04/04/2023, 5:42 PM
The auto-start functionality is tied to the user logging in, so I don't know if that would work in a headless setup. Controlling it via a service seems to be better.
You probably need to wait until the docker context has been created before you can switch to it, so you'll need a polling loop there I think
b

broad-train-31975

04/04/2023, 5:48 PM
Generally, do you think if all the configuration necessary for functionality is provided (as in config files), there will be no real need for the UI? Services can depend on each other, and wait for dependencies to be ready before running, systemd shines at it. I think headless as service might be an important use case, and given the integration in Rancher Desktop it’ll be better solutions than competition offers - and I mean not only Docker Desktop, but things like minikube etc
f

fast-garage-66093

04/04/2023, 5:54 PM
You can configure (almost) everything with options from
rdctl start
. The exceptions right now are: WSL Integration, muted diagnostics, and list of allowed images. None of those are relevant for headless operation on Linux.
Untitled
b

broad-train-31975

04/04/2023, 5:57 PM
perfect, thank you for reminding me about rdctl!
the only thing left unclear, for the first time, where rdctl comes from? As far as I can tell, rdctl is installed in ~/.rd/bin upon first start of Rancher Desktop by a particular user. Which is not really a problem because I can create a template with all things needed, preinstalled