is there a way to have docker build inside the lin...
# rancher-desktop
e
is there a way to have docker build inside the linux vm? I need to use linux binaries to compile a go program
Copy code
docker run --rm -it \
        -v `pwd`:/build \
        -e GOCACHE=/build/.linux_gocache \
        private-registry.com/containers/build-go:1.24-bookworm \
        make build
trying to do something like this but my ssh agent isn't passed to this image and it fails to attach when I try
f
Assuming you are on macOS or Linux, please file a GitHub issue about this. It is not really supported, but might work if you create an
override.yaml
file to forward your ssh agent from the host into the vm, and then forward it from the vm into the container. I don't have time to look into it now, but maybe somebody will see it on GitHub
e
thanks Jan as always!
to close this loop, updated
the override.yaml
with
echo -e "ssh:\n  forwardAgent: true" > ${HOME}/Library/Application\ Support/rancher-desktop/lima/_config/override.yaml
that was more than enough πŸ‘
f
It did automatically forward the agent from the VM into the container?
Or did you just build your software directly in the VM with
rdctl shell
, outside a container? That I would expect to work, but to forward it into the container I would have expected that you need to both set
SSH_AUTH_SOCK
inside the container, and also forward the socket explicitly with a bind-mount.
e
Correct I just assumed that was a default, forgot its an override. Not seeing any docs on rancher for it. Would an MR for that be cool?
f
Anyways, I'm glad you got it working, as I still don't have any time
e
Haha yep I meant could I MR that or do you not want to maintain that information on ranchers side?
f
I don't think we want to document this. Rancher Desktop is about running containers directly, or via Kubernetes, but not about providing a generic Linux VM
πŸ‘ 1
Sorry, what is
MR
?
e
As I thought, thanks Jan!
Merge request
Same as PR or pull request
πŸ‘ 1
f
It is intentionally not enabled because it doesn't work with containers right now. It is already a security risk to forward the agent into the VM. Making the socket name predictable would be even worse. So it would also need to be opt-in. So it eventually becomes a lot of effort for a niche feature, which is why it is unlikely to happen any time soon.
Anyways, I'm glad you have it working.
Personally I just run a separate Lima VM instead of abusing the Rancher Desktop one πŸ˜„
e
Haha very fair. Im not that clever to roll a custom VM, still much to learn
f
Assuming you have a separate Lima installation (don't re-use the Rancher Desktop one), all you need is
limactl start
and then edit the template to enable your agent forwarding.
e
Oh, interesting, I use rancher-desktop for k3s (development of go microservices, php apps, etc). Would that come by default? Maybe something for me to look into
f
Rancher Desktop comes with a bundled version of Lima, but you should not use it to run your own VMs. Install Lima with homebrew, or from source, and use that version instead.
If you are not using a package manager like homebrew, then just cloning the
lima-vm/lima
repo and running
make native install
is also enough to get it installed
e
Neat! Will take a look!
f
It is more like virtualbox, in that you can run different VMs and comes with lots of predefined templates
Untitled
e
Really appreciate the time to explain this Jan. So what would the use case of rancher-desktop be for you?
f
It provide a GUI, has support for snapshots, easier Kubernetes integration etc.
e
Got it! πŸ™‡ you're the best!
f
I'm a Lima maintainer and wrote many of the features needed to support Rancher Desktop. But Lima is a more generic VM manager. Like the name says LIMA (Linux Machines).
e
Haha yeah I've seen you contribute to both repos, pillar of knowledge 🀣
f
e
Im hoping I can gain enough knowledge to also help out one day
f
That would be cool! Lima is a vendor-neutral project, and we are just trying to move from CNCF "sandbox" to "incubating" status. Rancher Desktop is also open source, under the same Apache 2 license, but is a SUSE-led project.
e
Yep both are super neat in their own regard. ❗