Install Docker and Colima on macOS
brew install docker docker-compose
brew install colima
colima start --cpu 4 --memory 8 --mount-type virtiofs --vm-type vz --mount-inotify
Connect symbolic link of docker-compose
ln -sfn $( brew --prefix) /opt/docker-compose/bin/docker-compose ~ /.docker/cli-plugins/docker-compose
Install Docker buildx and compose v2
ARCH=arm64 # change to 'arm64' for m1
BUILDX_VERSION=v0.10.2
COMPOSE_VERSION=v2.21.0
mkdir -p ~ /.docker/cli-plugins
# Buildx
curl -LO https://github.com/docker/buildx/releases/download/${VERSION} /buildx-${BUILDX_VERSION} .darwin-${ARCH}
mv buildx-${VERSION} .darwin-${ARCH} ~ /.docker/cli-plugins/docker-buildx
chmod +x ~ /.docker/cli-plugins/docker-buildx
# Compose
curl -LO https://github.com/docker/compose/releases/download/${COMPOSE_VERSION} /compose-${COMPOSE_VERSION} .darwin-${ARCH}
mv compose-${COMPOSE_VERSION} .darwin-${ARCH} ~ /.docker/cli-plugins/docker-compose
chmod +x ~ /.docker/cli-plugins/docker-compose
Start Colima as agent on startup
cat << -EOF | sudo tee /opt/homebrew/bin/colima-agent
#!/bin/bash
export PATH="/opt/homebrew/bin"
function shutdown() {
colima stop
exit 0
}
trap shutdown SIGTERM
trap shutdown SIGINT
# wait until colima is running
while true; do
colima status &>/dev/null
if [[ \$ ? -eq 0 ]]; then
break;
fi
colima start --memory 4 --mount-type virtiofs --vm-type vz --mount-inotify
sleep 5
done
tail -f /dev/null &
wait \$ !
EOF
sudo chmod +x /opt/homebrew/bin/colima-agent
cat > $HOME /Library/LaunchAgents/com.github.abiosoft.colima.plist << -EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.abiosoft.colima</string>
<key>Program</key>
<string>/opt/homebrew/bin/colima-agent</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
EOF
launchctl load -w $HOME /Library/LaunchAgents/com.github.abiosoft.colima.plist