orbstack-best-practices by 0xbigboss/claude-code
npx skills add https://github.com/0xbigboss/claude-code --skill orbstack-best-practicesOrbStack 是一款适用于 macOS 的快速、轻量级 Docker 和 Linux 虚拟机运行时。它替代了 Docker Desktop,提供更好的性能和与 macOS 的无缝集成。
# 启动/停止
orb # 启动并打开默认机器的 shell
orb start # 启动 OrbStack
orb stop # 停止 OrbStack
# 机器管理
orb list # 列出机器
orb create ubuntu # 使用最新版本创建
orb create ubuntu:jammy myvm # 特定版本 + 名称
orb create --arch amd64 ubuntu intel # 在 Apple Silicon 上运行 x86
orb delete myvm # 删除机器
# Shell 访问
orb # 默认机器的 shell
orb -m myvm # 特定机器
orb -u root # 以 root 用户身份
orb -m myvm -u root # 组合使用
# 运行命令
orb uname -a # 在默认机器中运行
orb -m myvm ./script.sh # 在特定机器中运行
# 文件传输
orb push ~/local.txt # 复制到 Linux
orb pull ~/remote.txt # 从 Linux 复制
orb push -m vm ~/f.txt /dest/ # 推送到特定机器/路径
# Docker/K8s
orb restart docker # 重启 Docker 引擎
orb logs docker # Docker 引擎日志
orb start k8s # 启动 Kubernetes
orb delete k8s # 删除 K8s 集群
# 配置
orb config set memory_mib 8192 # 设置内存限制
orb config docker # 编辑 daemon.json
| 路径 | 描述 |
|---|---|
OrbStack is a fast, lightweight Docker and Linux VM runtime for macOS. Replaces Docker Desktop with better performance and seamless macOS integration.
# Start/stop
orb # Start + open default machine shell
orb start # Start OrbStack
orb stop # Stop OrbStack
# Machine management
orb list # List machines
orb create ubuntu # Create with latest version
orb create ubuntu:jammy myvm # Specific version + name
orb create --arch amd64 ubuntu intel # x86 on Apple Silicon
orb delete myvm # Delete machine
# Shell access
orb # Default machine shell
orb -m myvm # Specific machine
orb -u root # As root
orb -m myvm -u root # Combined
# Run commands
orb uname -a # Run in default machine
orb -m myvm ./script.sh # Run in specific machine
# File transfer
orb push ~/local.txt # Copy to Linux
orb pull ~/remote.txt # Copy from Linux
orb push -m vm ~/f.txt /dest/ # Push to specific machine/path
# Docker/K8s
orb restart docker # Restart Docker engine
orb logs docker # Docker engine logs
orb start k8s # Start Kubernetes
orb delete k8s # Delete K8s cluster
# Config
orb config set memory_mib 8192 # Set memory limit
orb config docker # Edit daemon.json
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
~/OrbStack/<machine>/ |
| 从 macOS 访问 Linux 文件 |
~/OrbStack/docker/volumes/ | 从 macOS 访问 Docker 卷 |
/mnt/mac/Users/... | 从 Linux 访问 macOS 文件 |
/mnt/machines/<name>/ | 从 Linux 访问其他机器 |
~/.orbstack/ssh/id_ed25519 | SSH 私钥 |
~/.orbstack/config/docker.json | Docker 守护进程配置 |
| 模式 | 描述 |
|---|---|
<machine>.orb.local | Linux 机器 |
<container>.orb.local | Docker 容器 |
<svc>.<project>.orb.local | Compose 服务 |
host.orb.internal | 从 Linux 机器访问 macOS |
host.docker.internal | 从容器访问 macOS |
docker.orb.internal | 从 Linux 机器访问 Docker |
orb create ubuntu # 最新版 Ubuntu
orb create ubuntu:noble devbox # Ubuntu 24.04,命名为 "devbox"
orb create --arch amd64 debian x86vm # 通过 Rosetta 进行 x86 模拟
orb create --set-password ubuntu pwvm # 设置密码
orb create ubuntu myvm -c cloud.yml # 使用 cloud-init
支持的发行版:Alma、Alpine、Arch、CentOS、Debian、Devuan、Fedora、Gentoo、Kali、NixOS、openSUSE、Oracle、Rocky、Ubuntu、Void
orb start myvm # 启动已停止的机器
orb stop myvm # 停止机器
orb restart myvm # 重启
orb delete myvm # 永久删除
orb default myvm # 设置为默认机器
orb logs myvm # 查看启动日志
使用自动化配置创建机器:
orb create ubuntu myvm -c user-data.yml
示例 user-data.yml:
#cloud-config
packages:
- git
- vim
- docker.io
users:
- name: dev
groups: sudo, docker
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
runcmd:
- systemctl enable docker
- systemctl start docker
调试 cloud-init:
orb logs myvm # 从 macOS 查看启动日志
orb -m myvm cloud-init status --long # 查看机器内部状态
orb -m myvm cat /var/log/cloud-init-output.log
Linux 机器中的服务器会自动映射到 localhost:
# 在 Linux 中:python3 -m http.server 8000
# 从 macOS:curl localhost:8000 或 curl myvm.orb.local:8000
# 从 Linux 机器
curl host.orb.internal:3000
# 从 Docker 容器
curl host.docker.internal:3000
orb config set network_proxy http://proxy:8080orb config set network_proxy none# 相同的路径有效
cat /Users/allen/file.txt
cat /mnt/mac/Users/allen/file.txt # 显式前缀
ls ~/OrbStack/myvm/home/user/
ls ~/OrbStack/docker/volumes/myvolume/
orb push ~/local.txt # 到默认机器的 home 目录
orb pull ~/remote.txt # 从默认机器拉取
orb push -m vm ~/f.txt /tmp/ # 到特定路径
内置多路复用 SSH 服务器(无需为每个机器单独设置):
ssh orb # 默认机器
ssh myvm@orb # 特定机器
ssh user@myvm@orb # 特定用户 + 机器
VS Code :安装 "Remote - SSH" 扩展,连接到 orb 或 myvm@orb
JetBrains :主机 localhost,端口 32222,密钥 ~/.orbstack/ssh/id_ed25519
[servers]
myvm@orb ansible_user=ubuntu
SSH 代理转发是自动的。
docker run --name web nginx
# 访问:http://web.orb.local (Web 服务器无需指定端口)
# Compose:<service>.<project>.orb.local
所有 .orb.local 域名的零配置 HTTPS:
curl https://mycontainer.orb.local
docker run -l dev.orbstack.domains=myapp.local nginx
docker run --net=host nginx
# localhost 双向工作
docker run --platform linux/amd64 ubuntu
export DOCKER_DEFAULT_PLATFORM=linux/amd64 # 默认使用 x86
docker run -v /run/host-services/ssh-auth.sock:/agent.sock \
-e SSH_AUTH_SOCK=/agent.sock alpine
为获得性能,优先使用卷(数据保留在 Linux 中):
docker run -v mydata:/data alpine # 卷(快速)
docker run -v ~/code:/code alpine # 绑定挂载(较慢)
orb start k8s # 启动集群
kubectl get nodes # 包含 kubectl
所有服务类型都可以从 macOS 访问,无需端口转发:
curl myservice.default.svc.cluster.local # cluster.local 有效
curl 192.168.194.20 # Pod IP 有效
curl myservice.k8s.orb.local # LoadBalancer 通配符
本地镜像立即可用(使用非 latest 标签或 imagePullPolicy: IfNotPresent)。
orb report # 生成诊断报告
orb logs myvm # 机器启动日志
orb logs docker # Docker 引擎日志
orb restart docker # 重启 Docker
orb reset # 恢复出厂设置(删除所有内容)
无法连接到 Docker 守护进程 :使用 orb start 启动 OrbStack,或使用 docker context use orbstack 修复上下文
机器无法启动 :检查 orb logs myvm,尝试 orb restart myvm
Rosetta x86 错误 :安装 x86 libc:
sudo dpkg --add-architecture amd64
sudo apt update && sudo apt install libc6:amd64
orb config set rosetta true # 启用 x86 模拟
orb config set memory_mib 8192 # 内存限制(MiB)
orb config set cpu 4 # CPU 限制(核心数)
orb config set network_proxy auto # 代理(auto/none/url)
Docker 守护进程配置位于 ~/.orbstack/config/docker.json:
{
"insecure-registries": ["registry.local:5000"],
"registry-mirrors": ["https://mirror.gcr.io"]
}
使用 orb restart docker 应用更改。
mac open https://example.com # 在 macOS 浏览器中打开 URL
mac uname -a # 运行 macOS 命令
mac link brew # 链接命令以供重用
mac notify "Build done" # 发送通知
转发环境变量:
ORBENV=AWS_PROFILE:EDITOR orb ./deploy.sh
每周安装次数
79
仓库
GitHub 星标数
36
首次出现时间
2026年1月24日
安全审计
安装于
codex64
gemini-cli63
claude-code62
opencode61
github-copilot57
cursor57
| Path | Description |
|---|---|
~/OrbStack/<machine>/ | Linux files from macOS |
~/OrbStack/docker/volumes/ | Docker volumes from macOS |
/mnt/mac/Users/... | macOS files from Linux |
/mnt/machines/<name>/ | Other machines from Linux |
~/.orbstack/ssh/id_ed25519 | SSH private key |
~/.orbstack/config/docker.json | Docker daemon config |
| Pattern | Description |
|---|---|
<machine>.orb.local | Linux machine |
<container>.orb.local | Docker container |
<svc>.<project>.orb.local | Compose service |
host.orb.internal | macOS from Linux machine |
host.docker.internal | macOS from container |
docker.orb.internal | Docker from Linux machine |
orb create ubuntu # Latest Ubuntu
orb create ubuntu:noble devbox # Ubuntu 24.04 named "devbox"
orb create --arch amd64 debian x86vm # x86 emulation via Rosetta
orb create --set-password ubuntu pwvm # With password set
orb create ubuntu myvm -c cloud.yml # With cloud-init
Supported distros: Alma, Alpine, Arch, CentOS, Debian, Devuan, Fedora, Gentoo, Kali, NixOS, openSUSE, Oracle, Rocky, Ubuntu, Void
orb start myvm # Start stopped machine
orb stop myvm # Stop machine
orb restart myvm # Restart
orb delete myvm # Delete permanently
orb default myvm # Set as default machine
orb logs myvm # View boot logs
Create machines with automated provisioning:
orb create ubuntu myvm -c user-data.yml
Example user-data.yml:
#cloud-config
packages:
- git
- vim
- docker.io
users:
- name: dev
groups: sudo, docker
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
runcmd:
- systemctl enable docker
- systemctl start docker
Debug cloud-init:
orb logs myvm # Boot logs from macOS
orb -m myvm cloud-init status --long # Status inside machine
orb -m myvm cat /var/log/cloud-init-output.log
Servers in Linux machines are automatically on localhost:
# In Linux: python3 -m http.server 8000
# From macOS: curl localhost:8000 or curl myvm.orb.local:8000
# From Linux machine
curl host.orb.internal:3000
# From Docker container
curl host.docker.internal:3000
orb config set network_proxy http://proxy:8080orb config set network_proxy none# Same paths work
cat /Users/allen/file.txt
cat /mnt/mac/Users/allen/file.txt # Explicit prefix
ls ~/OrbStack/myvm/home/user/
ls ~/OrbStack/docker/volumes/myvolume/
orb push ~/local.txt # To default machine home
orb pull ~/remote.txt # From default machine
orb push -m vm ~/f.txt /tmp/ # To specific path
Built-in multiplexed SSH server (no per-machine setup):
ssh orb # Default machine
ssh myvm@orb # Specific machine
ssh user@myvm@orb # Specific user + machine
VS Code : Install "Remote - SSH" extension, connect to orb or myvm@orb
JetBrains : Host localhost, Port 32222, Key ~/.orbstack/ssh/id_ed25519
[servers]
myvm@orb ansible_user=ubuntu
SSH agent forwarding is automatic.
docker run --name web nginx
# Access: http://web.orb.local (no port needed for web servers)
# Compose: <service>.<project>.orb.local
Zero-config HTTPS for all .orb.local domains:
curl https://mycontainer.orb.local
docker run -l dev.orbstack.domains=myapp.local nginx
docker run --net=host nginx
# localhost works both directions
docker run --platform linux/amd64 ubuntu
export DOCKER_DEFAULT_PLATFORM=linux/amd64 # Default to x86
docker run -v /run/host-services/ssh-auth.sock:/agent.sock \
-e SSH_AUTH_SOCK=/agent.sock alpine
Prefer volumes for performance (data stays in Linux):
docker run -v mydata:/data alpine # Volume (fast)
docker run -v ~/code:/code alpine # Bind mount (slower)
orb start k8s # Start cluster
kubectl get nodes # kubectl included
All service types accessible from macOS without port-forward:
curl myservice.default.svc.cluster.local # cluster.local works
curl 192.168.194.20 # Pod IPs work
curl myservice.k8s.orb.local # LoadBalancer wildcard
Local images available immediately (use non-latest tag or imagePullPolicy: IfNotPresent).
orb report # Generate diagnostic report
orb logs myvm # Machine boot logs
orb logs docker # Docker engine logs
orb restart docker # Restart Docker
orb reset # Factory reset (deletes everything)
Cannot connect to Docker daemon : Start OrbStack with orb start, or fix context with docker context use orbstack
Machine not starting : Check orb logs myvm, try orb restart myvm
Rosetta x86 error : Install x86 libc:
sudo dpkg --add-architecture amd64
sudo apt update && sudo apt install libc6:amd64
orb config set rosetta true # Enable x86 emulation
orb config set memory_mib 8192 # Memory limit (MiB)
orb config set cpu 4 # CPU limit (cores)
orb config set network_proxy auto # Proxy (auto/none/url)
Docker daemon config at ~/.orbstack/config/docker.json:
{
"insecure-registries": ["registry.local:5000"],
"registry-mirrors": ["https://mirror.gcr.io"]
}
Apply with orb restart docker.
mac open https://example.com # Open URL in macOS browser
mac uname -a # Run macOS command
mac link brew # Link command for reuse
mac notify "Build done" # Send notification
Forward env vars:
ORBENV=AWS_PROFILE:EDITOR orb ./deploy.sh
Weekly Installs
79
Repository
GitHub Stars
36
First Seen
Jan 24, 2026
Security Audits
Installed on
codex64
gemini-cli63
claude-code62
opencode61
github-copilot57
cursor57
AI新闻播客制作技能:实时新闻转对话式播客脚本与音频生成
1,200 周安装