SuperAPI AI 工具集

apple-containers

通用与其它

查看项目

更新于 10-15 23:48

技能介绍

用途:在 macOS 上通过 Apple Containers 运行 OCI 容器,容器内是轻量虚拟机(具备 hypervisor 隔离,而非仅命名空间),用于搭建带完整 Linux、Tailscale SSH 访问与 Zed 远程开发的本地开发环境。

前提条件:macOS 26+(Tahoe)、Apple 芯片;已装 container CLI(通过 install.sh --apps);守护进程运行中,执行 container system start;以及一个 Tailscale 认证密钥。

创建流程:

  1. 创建并启动容器:container run --name <name> -d --cpus 4 --memory 8G ubuntu:25.04 sleep infinity,命名约定 ivs-<purpose>。
  2. 安装基础包并建用户,需配置免密 sudo(安装脚本会用 sudo 执行 apt、chsh、systemctl、tailscale;无 NOPASSWD 会因无 TTY 而卡住)。
  3. 安装 Tailscale 与点文件。tailscaled 必须用 container exec -d 启动,不要在 container exec 内用 &(会产生僵尸进程)。随后取认证密钥并执行 tailscale up 带 --ssh,再从主机验证 SSH 连通后才继续。点文件安装需通过 Tailscale SSH 执行,以便转发 Mac 的 1Password 代理,否则 Zed 的 Claude 代理会报错。
  4. 克隆仓库:借助主机 SSH 配置向 *.ts.net 转发代理,无需 token;install.sh 会为 Linux 配置 GitHub SSH 走 443 端口(Apple Containers 封锁 22 端口)。
  5. 从 Zed 连接:zed ssh://klundstedt@<name>/home/klundstedt/<repo>;不要把 ssh_connections 写进 zed/settings.json。

CLI 常用命令:container list / exec / exec -u / exec -d / exec -e / stop / start / rm / inspect / logs。文件传输可通过管道配合 container exec -i 与 tar 实现。

限制与排障:容器无法启动先运行 container system start;SSH 失败检查容器内 tailscale status 与主机名;install.sh 失败先确认已装 git、curl,可用 bash -x 调试;Zed 报 “Query closed before response received” 说明容器未安装 Claude Code,需运行 install.sh。价格、更多平台支持等信息暂未提供。