Rancher Desktop

Rancher Desktop 是 SUSE推出的 Rancher 桌面软件,跨平台为 macOS (基于 Lima: Linux Machines ), WindowsLinux 桌面提供了容器和 Kubernetes 管理,是开发者的基础工具

我在 Lima运行Alpine Linux虚拟机 遇到挫折,无法正常启动看似安装完成的 Alpine Linux ,转念一想,在 macOS 平台上,SUSE的 Racher Desktop 底层不就是基于 Lima: Linux Machines 么?并且lima的GitHub中, alpine-lima: build Alpine based ISO images for lima 正是用于构建一个用于 Rancher Desktop 底层Lima所使用的ISO镜像工具。

有商业公司支持的开源软件通常会更为易用一些,所以我尝试在Rancher Desktop中来运行 Alpine Linux

Rancher Desktop 简介

Docker Desktop 类似, Rancher Desktop 也是一个在桌面提供 Container 管理和 Kubernetes 的应用,并且跨平台在 macOS , WindowsLinux 运行。

  • 容器管理提供了构建、推送和拉取镜像的能力,不仅提供Docker CLI(可选择使用 Mobydockerd 作为引擎),也可以使用 nerdctl (当选择 containerd运行时(runtime) 作为引擎)

  • 在Rancher Desktop中通过 K3s - 轻量级Kubernetes 内建提供了 Kubernetes ,方便开发者自由选择不同的Kubernetes版本以及重置Kubernetes环境,可以快速完成测试环境搭建

注意, Rancher Desktop 实际上和 Rancher 是不同的产品, Rancher 是用于管理 Kubernetes 集群的解决方案,而 Rancher Desktop 仅仅是提供本地Kubernetes和容器管理的平台。所以,如果想要在本地运行 Rancher ,你需要在 Rancher Desktop 中独立安装 Rancher

备注

我觉得 Rancher Desktop 的价值在于统一打包了常用的工具:

以及一系列容器工具链,并且简化了升级工作。此外,内置Kubernetes使得开发专注于业务和工具开发,而不是底层架构永无止境的部署优化。

Rancher Desktop 工作原理

../_images/how-it-works-rancher-desktop.svg

Rancher Desktop实际上是一个Electron程序,包装了一系列开源工具来提供易用的用户体院。在 macOSLinux 平台,Rancher Desktop使用与你寄来运行 containerd运行时(runtime)Docker 以及 Kubernetes 。而在 Windows 平台则调用Windows Subsystem for Linux v2。

首次启动

首次启动 Rancher Desktop 会提供一些默认常用配置(激活 Kubernetes ,使用 Docker 引擎):

../_images/rancher_desktop_first.png

版本运行要求

这里我遇到一个启动报错,原因是:

下载镜像报错
   'time="2025-10-17T15:21:23+08:00" level=warning msg="field `mounts[1].location` refers to a non-existent directory: \\"/tmp/rancher-desktop\\":"\n' +
    'time="2025-10-17T15:21:23+08:00" level=info msg="Starting the instance \\"0\\" with VM driver \\"qemu\\""\n' +
    'time="2025-10-17T15:21:23+08:00" level=info msg="Attempting to download the image" arch=x86_64 digest= location="/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/alpine-lima-v0.2.44.rd1-rd-3.21.3.iso"\n' +
    'time="2025-10-17T15:21:23+08:00" level=info msg="Downloaded the image from \\"/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/alpine-lima-v0.2.44.rd1-rd-3.21.3.iso\\""\n' +
    'time="2025-10-17T15:21:23+08:00" level=fatal msg="failed to get the information of base disk \\"/Users/admin/Library/Application Support/rancher-desktop/lima/0/basedisk\\": failed to run [qemu-img info --output=json --force-share /Users/admin/Library/Application Support/rancher-desktop/lima/0/basedisk]: stdout=\\"\\", stderr=\\"dyld: Symbol not found: _IOMainPort\\\\n  Referenced from: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/qemu-img (which was built for Mac OS X 13.0)\\\\n  Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit\\\\n\\\\n\\": signal: abort trap"\n',
  code: 1,
  signal: undefined,
  [Symbol(child-process.command)]: '/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl start --tty=false /Users/admin/Library/Application Support/rancher-desktop/lima/_config/0.yaml'
}

下载镜像报错,可以看到 qemu-img 是针对 macOS 13编译的,看起来我的操作系统 Big Sur 11 不满足要求

参考 Rancher Desktop Installation ,果然看到要求 macOS 13 (Ventura) or higher (从 1.18 开始)

根据 Rancher Desktop 1.17 Installation 可以看到回退到 1.17 版本可以在 macOS Catalina 10.15 or higher 上运行

所以我卸载1.20,重新安装 1.17

1.17 启动报错一

由于之前安装了 1.20 配置了启动 kubernetes 1.3x 启动,但是回退到 1.17 之后配置残留,所以启动时会报错:

启动 kubernetes 报错
Error Starting Kubernetes

Error: Invalid state, no container engine client available.

Some recent logfile lines:

2025-10-17T08:07:04.963Z: Administrator access disallowed, not using socket_vmnet.
2025-10-17T08:07:04.964Z: Base disk is 0.2.44, newer than 0.2.41.rd3 - aborting.
2025-10-17T08:07:04.964Z: Error starting lima: Rancher Desktop Update Required: This Rancher Desktop installation appears to be older than the version that created your existing Kubernetes cluster. Please either update Rancher Desktop or reset Kubernetes and container images.
    at Ft.updateBaseDisk (/Applications/Rancher Desktop.app/Contents/Resources/app.asar/dist/app/background.js:29:122412)
    at Ft.updateConfig (/Applications/Rancher Desktop.app/Contents/Resources/app.asar/dist/app/background.js:29:126224)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  fatal: false
}

既然升级Rancher Desktop是不可能的,就只有 reset Kubernetes and container images 了(需要执行 factory reset ):

  • 在 Rancher Desktop 中,访问 Troubleshooting

  • 点击 Factory Reset 按钮

这个步骤会清理掉Kubernetes集群以及已经下载的镜像,整个Rancher Desktop会退出。再次启动Rancher Desktop之后,会重新引导进行一次配置

1.17 启动报错二

没有想到实际上 1.17 携带的 QEMU 依然是针对 macOS 13 编译的,我回退到 Rancher Desktop 1.17 之后启动依然报错,检查发现在 /Applications/Rancher\ Desktop.app/Contents/Resources/resources/darwin/lima/bin/ 目录下的 qemu-imgqemu-system-x86_64 都是相同提示:

qemu 相关程序都是针对macOS 13编译的二进制
dyld: Symbol not found: _IOMainPort
  Referenced from: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/qemu-img (which was built for Mac OS X 13.0)
  Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

zsh: abort       --help

dyld: Symbol not found: _IOMainPort
  Referenced from: /Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/qemu-system-x86_64 (which was built for Mac OS X 13.0)
  Expected in: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

zsh: abort       --version

唉,这发行版搞得有点粗糙...

我突然后悔之前 uninstallMacPorts 编译的 QEMU

好吧,我自己重新搞一次 MacPorts安装旧版本qemu ,然后再复制过来 qemu-imgqemu-system-x86_64

果然解决了启动问题,能够正常启动 qemu-system-x86_64

参考