Replacing Docker Desktop with Colima on macOS

Today I banished Docker Desktop from my laptop in favor of FOSS. The goal was to reduce bloat and unnecessary features. This post documents my setup steps.

Tooling Options

ToolLicenseDocker API / compose / buildxTrade-offs
ColimaMITYes. Runs the real dockerd in a Lima VMCLI only, no GUI. Uses Apple’s Virtualization.framework, with Rosetta for amd64. Works with the standard docker CLI.
LimaApache-2.0Yes, through a docker templateThe VM layer underneath Colima. You configure the VM and the container runtime yourself.
Podman (podman machine, Podman Desktop)Apache-2.0Through a compatibility socketDaemonless and rootless by default. Not dockerd: compose runs through podman compose, and builds use Buildah rather than buildx.
Rancher DesktopApache-2.0Yes (moby), or containerd/nerdctlElectron GUI. Bundles k3s for local Kubernetes.

Install Colima and the docker CLI

brew install colima docker docker-compose docker-buildx \
  docker-credential-helper docker-credential-helper-ecr

mkdir ~/.colima
colima start --vm-type vz --vz-rosetta --mount-type virtiofs \
  --cpu 6 --memory 12 --disk 100
colima stop

colima start creates the VM and switches to a colima docker context. --vz-rosetta registers Apple’s Rosetta in the VM through binfmt, so --platform linux/amd64 containers and the amd64 half of multi-arch buildx builds run at near-native speed instead of under QEMU.

Create ~/.colima before the first start. Colima keeps its config and VM in ~/.colima if that directory exists. Otherwise it uses $XDG_CONFIG_HOME/colima, but only when XDG_CONFIG_HOME is set, and the launchd agent in the next section doesn’t get your shell’s environment. Without the directory, a shell that sets XDG_CONFIG_HOME and the login agent end up with two separate VMs, each with its own settings and docker socket. Creating it pins both to ~/.colima. If your shell sets XDG_CONFIG_HOME, each colima command then prints found ~/.colima, ignoring $XDG_CONFIG_HOME. That’s expected, and docker commands don’t print it.

Start Colima at login

brew services start colima

This installs a launchd agent (homebrew.mxcl.colima) that runs colima start -f when you log in. With no flags, colima start reads the settings saved at the first start from ~/.colima/default/colima.yaml (CPU, memory, disk, vmType: vz, rosetta: true, mountType: virtiofs). To change them, edit that file, then brew services restart colima.

brew services info colima    # Running / Loaded
brew services stop colima    # stop it and remove it from login
colima status                # VM and docker socket status

~/.docker/config.json

Change the credential store from desktop to osxkeychain. Both helpers read the same macOS Keychain entries, so existing registry logins keep working without logging in again. Point the CLI at the Homebrew compose and buildx plugins, and drop the Desktop-only plugin hooks (scout, debug, cli-hints):

{
  "auths": { "...": {} },
  "credsStore": "osxkeychain",
  "currentContext": "colima",
  "cliPluginsExtraDirs": ["/opt/homebrew/lib/docker/cli-plugins"]
}

The first time docker-credential-osxkeychain reads a login that Docker Desktop saved, macOS asks for your login keychain password. The dialog only says the docker credential helper wants keychain access. It isn’t a request for admin rights. Enter your login password and choose Always Allow. Pulls of public images trigger it too, because the CLI looks up your Docker Hub login on every pull from docker.io.

Removing Docker Desktop

Docker’s official uninstall has two parts. First run the bundled uninstaller, either Troubleshoot → Uninstall in the app or /Applications/Docker.app/Contents/MacOS/uninstall. Then drag the app to the Trash and delete a list of leftover files by hand.

The command-line uninstaller can fail with operation not permitted on ~/Library/Group Containers/group.com.docker. macOS app-data protection stops a terminal from touching another app’s container until you allow it.

The script below removes everything in one pass:

  • the app bundle
  • launchd jobs and privileged helpers
  • the /usr/local/bin symlinks, which otherwise hide the Homebrew docker
  • the ~/Library data, including a VM disk image that can be tens of GB
  • Desktop-only state in ~/.docker

It keeps ~/.docker/config.json, the colima context and the Keychain credentials.

Expect it to report STILL PRESENT for ~/Library/Containers/com.docker.docker and ~/Library/Group Containers/group.com.docker. macOS tags these as Docker’s app containers, and only the owning app or a process with Full Disk Access can change them. sudo rm fails with Operation not permitted, and so do Finder’s Move to Trash and AppleScript. To remove them:

  1. Open System Settings → Privacy & Security → Full Disk Access and turn on your terminal app.
  2. Quit the terminal completely. If you use tmux, run tmux kill-server first, because a tmux server that’s already running keeps the old permissions. Then reopen the terminal.
  3. Run rm -rf ~/Library/Containers/com.docker.docker ~/Library/Group\ Containers/group.com.docker without sudo.
  4. Optionally, turn Full Disk Access back off.
#!/bin/zsh
# Remove Docker Desktop and all of its leftovers. Colima/Homebrew docker are left intact.
setopt nullglob
D=/opt/homebrew/bin/docker

echo "== stop any Docker Desktop processes"
osascript -e 'quit app "Docker"' 2>/dev/null
pkill -f '/Applications/Docker.app' 2>/dev/null
pkill -f 'com.docker.(build|dev-envs|backend|virtualization|vmnetd)' 2>/dev/null

echo "== root-owned: app bundle, launchd, helpers, /usr/local/bin symlinks"
sudo launchctl bootout system/com.docker.socket 2>/dev/null
sudo launchctl bootout system/com.docker.vmnetd 2>/dev/null
sudo rm -rf \
  /Applications/Docker.app \
  /Library/LaunchDaemons/com.docker.* \
  /Library/PrivilegedHelperTools/com.docker.* \
  /Library/Application\ Support/com.docker.* \
  /Library/Preferences/com.docker.* \
  /usr/local/bin/com.docker.cli \
  /usr/local/bin/docker \
  /usr/local/bin/docker-compose \
  /usr/local/bin/docker-compose-v1 \
  /usr/local/bin/docker-credential-desktop \
  /usr/local/bin/docker-credential-ecr-login \
  /usr/local/bin/docker-credential-osxkeychain \
  /usr/local/bin/docker-index \
  /usr/local/bin/hub-tool \
  /usr/local/bin/kubectl.docker \
  /usr/local/bin/vpnkit \
  /etc/paths.d/docker* \
  /var/run/docker.sock

echo "== ~/Library app data"
for p in \
  "$HOME/Library/Containers/com.docker.docker" \
  "$HOME/Library/Group Containers/group.com.docker" \
  "$HOME/Library/Application Scripts/group.com.docker" \
  "$HOME/Library/Application Support/Docker Desktop" \
  "$HOME/Library/Caches/com.docker.docker" \
  "$HOME/Library/Caches/Docker Desktop" \
  "$HOME/Library/HTTPStorages/com.docker.docker" \
  "$HOME/Library/Logs/Docker Desktop" \
  "$HOME/Library/Preferences/com.docker.docker.plist" \
  "$HOME/Library/Preferences/com.electron.dockerdesktop.plist" \
  "$HOME/Library/Saved Application State/com.electron.dockerdesktop.savedState" \
  $HOME/Library/LaunchAgents/com.docker.*
do
  [[ -e "$p" ]] || continue
  rm -rf "$p" 2>/dev/null || sudo rm -rf "$p"
  [[ -e "$p" ]] && echo "STILL PRESENT (macOS app-data protection): $p" || echo "removed: $p"
done
defaults delete com.docker.docker 2>/dev/null
defaults delete com.electron.dockerdesktop 2>/dev/null

echo "== ~/.docker: Desktop-only state (keeps config.json + colima context)"
rm -f  ~/.docker/cli-plugins/docker-{ai,buildx,compose,debug,desktop,dev,extension,feedback,init,sbom,scout}
rmdir  ~/.docker/cli-plugins 2>/dev/null
rm -rf ~/.docker/{desktop-build,devenvironments,mutagen,run,sbom,scan,scout,buildx,features.json,daemon.json,config.json.pre-colima-backup}
$D context rm -f desktop-linux 2>/dev/null

echo "== verify"
echo "processes: $(pgrep -f 'Docker.app|com.docker' | wc -l | tr -d ' ')"
left=0
for p in /Applications/Docker.app /Library/LaunchDaemons/com.docker.* /Library/PrivilegedHelperTools/com.docker.* \
  /usr/local/bin/*docker* /usr/local/bin/{hub-tool,vpnkit} \
  ~/Library/*/*com.docker* ~/Library/*/*Docker\ Desktop* ~/Library/*/*dockerdesktop*
do
  [[ -e "$p" || -L "$p" ]] && { echo "LEFTOVER: $p"; left=1; }
done
(( left )) && echo "Delete leftovers in Finder (drag to Trash), or grant the terminal Full Disk Access and re-run." \
  || echo "no Docker Desktop leftovers found"
echo "docker -> $(command -v docker)"; docker context ls

Images and volumes don’t carry over; Docker Desktop’s VM disk is deleted along with everything else. Before you remove it, push anything you need to a registry or docker save it. You can copy named volumes between contexts with a tar pipe:

docker --context desktop-linux run --rm -v VOL:/v alpine tar -C /v -cf - . \
  | docker --context colima run --rm -i -v VOL:/v alpine tar -C /v -xf -

Checks after the switch

brew services info colima                           # Running: true
colima status                                       # docker socket: ~/.colima/default/docker.sock
colima ssh -- ls /proc/sys/fs/binfmt_misc           # includes rosetta
docker context ls                                   # colima *
docker run --rm alpine uname -m                     # aarch64
docker run --rm --platform linux/amd64 alpine uname -m   # x86_64
docker buildx create --name multi --driver docker-container --use
docker buildx build --platform linux/amd64,linux/arm64 -t test .