| name | orbstack-best-practices |
| description | Patterns for OrbStack Linux VMs and Docker on macOS. Covers orbctl/orb commands, machine lifecycle, cloud-init, networking, file sharing, and SSH access. Must use when working with OrbStack, orbctl commands, or Linux VMs on macOS. |
OrbStack Best Practices
OrbStack is a fast, lightweight Docker and Linux VM runtime for macOS. Replaces Docker Desktop with better performance and seamless macOS integration.
Core Commands
orb
orb start
orb stop
orb list
orb create ubuntu
orb create ubuntu:jammy myvm
orb create --arch amd64 ubuntu intel
orb delete myvm
orb
orb -m myvm
orb -u root
orb -m myvm -u root
orb uname -a
orb -m myvm ./script.sh
orb push ~/local.txt
orb pull ~/remote.txt
orb push -m vm ~/f.txt /dest/
orb restart docker
orb logs docker
orb start k8s
orb delete k8s
orb config set memory_mib 8192
orb config docker
Key Paths
| 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 |
DNS Names
| 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 |
Machine Lifecycle
Creation
orb create ubuntu
orb create ubuntu:noble devbox
orb create --arch amd64 debian x86vm
orb create --set-password ubuntu pwvm
orb create ubuntu myvm -c cloud.yml
Supported distros: Alma, Alpine, Arch, CentOS, Debian, Devuan, Fedora, Gentoo, Kali, NixOS, openSUSE, Oracle, Rocky, Ubuntu, Void
Lifecycle
orb start myvm
orb stop myvm
orb restart myvm
orb delete myvm
orb default myvm
orb logs myvm
Cloud-Init
Create machines with automated provisioning:
orb create ubuntu myvm -c user-data.yml
Example user-data.yml:
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
orb -m myvm cloud-init status --long
orb -m myvm cat /var/log/cloud-init-output.log
Networking
Port Access
Servers in Linux machines are automatically on localhost:
Connecting from Linux to macOS
curl host.orb.internal:3000
curl host.docker.internal:3000
VPN/Proxy
- Fully VPN-compatible with automatic DNS handling
- Follows macOS proxy settings automatically
- Custom proxy:
orb config set network_proxy http://proxy:8080
- Disable:
orb config set network_proxy none
File Sharing
macOS Files from Linux
cat /Users/allen/file.txt
cat /mnt/mac/Users/allen/file.txt
Linux Files from macOS
ls ~/OrbStack/myvm/home/user/
ls ~/OrbStack/docker/volumes/myvolume/
Transfer Commands
orb push ~/local.txt
orb pull ~/remote.txt
orb push -m vm ~/f.txt /tmp/
SSH Access
Built-in multiplexed SSH server (no per-machine setup):
ssh orb
ssh myvm@orb
ssh user@myvm@orb
IDE Setup
VS Code: Install "Remote - SSH" extension, connect to orb or myvm@orb
JetBrains: Host localhost, Port 32222, Key ~/.orbstack/ssh/id_ed25519
Ansible
[servers]
myvm@orb ansible_user=ubuntu
SSH agent forwarding is automatic.
Docker Integration
Container Domains
docker run --name web nginx
HTTPS
Zero-config HTTPS for all .orb.local domains:
curl https://mycontainer.orb.local
Custom Domains
docker run -l dev.orbstack.domains=myapp.local nginx
Host Networking
docker run --net=host nginx
x86 Emulation
docker run --platform linux/amd64 ubuntu
export DOCKER_DEFAULT_PLATFORM=linux/amd64
SSH Agent in Containers
docker run -v /run/host-services/ssh-auth.sock:/agent.sock \
-e SSH_AUTH_SOCK=/agent.sock alpine
Volumes vs Bind Mounts
Prefer volumes for performance (data stays in Linux):
docker run -v mydata:/data alpine
docker run -v ~/code:/code alpine
Kubernetes
orb start k8s
kubectl get nodes
All service types accessible from macOS without port-forward:
curl myservice.default.svc.cluster.local
curl 192.168.194.20
curl myservice.k8s.orb.local
Local images available immediately (use non-latest tag or imagePullPolicy: IfNotPresent).
Troubleshooting
orb report
orb logs myvm
orb logs docker
orb restart docker
orb reset
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
Configuration
orb config set rosetta true
orb config set memory_mib 8192
orb config set cpu 4
orb config set network_proxy auto
Docker daemon config at ~/.orbstack/config/docker.json:
{
"insecure-registries": ["registry.local:5000"],
"registry-mirrors": ["https://mirror.gcr.io"]
}
Apply with orb restart docker.
macOS Commands from Linux
mac open https://example.com
mac uname -a
mac link brew
mac notify "Build done"
Forward env vars:
ORBENV=AWS_PROFILE:EDITOR orb ./deploy.sh