⚠️ this PR needs merging before this will work. Until then, your agent can patch your local copy using the diff: redwoodjs/agent-ci#161
This note documents the current working method for using Docker from the Tart VM by forwarding the host Mac's Docker socket over a Tart-reachable TCP listener.
The Tart VM is a separate macOS guest. It is not inside Docker Desktop's managed Linux VM, so Docker's /var/run/docker.sock.raw guidance for Docker Desktop extensions does not apply directly here.
The working setup is:
- Run
socaton the host Mac. - Bind it to the Tart-facing host IP:
192.168.110.1. - Forward that TCP listener to the host's Docker socket at
/var/run/docker.sock. - Point the VM Docker client at
tcp://192.168.110.1:2375.
This method exposes host Docker access to anything in the VM that can reach 192.168.110.1:2375.
That means:
- it is convenient
- it is not tightly scoped
- it should be treated as high-privilege host access through Docker
It is acceptable here because it is simple and working, but it is not equivalent to a least-privilege design.
On the host Mac:
- Docker Desktop is installed and running.
docker psworks on the host.socatis installed./var/run/docker.sockexists.
Checks:
docker ps
ls -l /var/run/docker.sock
which socatIf socat is missing:
brew install socatThese files now exist in this repo:
- Script:
docker-host-proxy.sh - LaunchAgent:
com.scribular.host-docker-proxy.plist
The installed host copy of the script should live at:
~/docker-host-proxy.sh
Purpose:
- verifies
socatexists - verifies
/var/run/docker.sockexists - starts the TCP-to-Unix proxy on
192.168.110.1:2375
Current behavior:
socat TCP-LISTEN:2375,bind=192.168.110.1,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sockPurpose:
- starts the host proxy at login
- keeps it running
- logs output to
/tmp/host-docker-proxy.log
Make sure the script is executable:
cp ./docker-host-proxy.sh ~/docker-host-proxy.sh
chmod +x ~/docker-host-proxy.shInstall the LaunchAgent:
cp ./com.scribular.host-docker-proxy.plist ~/Library/LaunchAgents/
launchctl unload ~/Library/LaunchAgents/com.scribular.host-docker-proxy.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/com.scribular.host-docker-proxy.plistVerify it is running:
launchctl list | grep host-docker-proxy
lsof -iTCP:2375 -sTCP:LISTEN -n -P
tail -f /tmp/host-docker-proxy.logExpected listener:
192.168.110.1:2375
If you want to run it manually instead of using launchd:
socat TCP-LISTEN:2375,bind=192.168.110.1,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sockInside the Tart VM:
- Homebrew is installed.
- Docker CLI is installed.
- The VM can reach the host at
192.168.110.1.
Install Docker CLI if needed:
brew install dockerPoint the VM Docker client at the host proxy:
export DOCKER_HOST=tcp://192.168.110.1:2375If you want a named Docker context:
docker context create host-mac --docker "host=tcp://192.168.110.1:2375"
docker context use host-macIf an older host-mac context exists and should be replaced:
docker context use default
docker context rm host-mac
docker context create host-mac --docker "host=tcp://192.168.110.1:2375"
docker context use host-macThe VM Docker client may fail to pull images if ~/.docker/config.json references Docker Desktop's credential helper:
docker-credential-desktop
Typical error:
docker: error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH
Inspect the current config:
cat ~/.docker/config.jsonIf it contains entries like these, remove them:
"credsStore": "desktop""credHelpers": { ... "desktop" ... }
Minimal safe VM config:
mkdir -p ~/.docker
printf '{}\n' > ~/.docker/config.jsonBasic connectivity test from the VM:
docker version
docker psFull end-to-end test:
docker run --rm hello-worldIf this works, the full flow is operational:
- VM Docker CLI
- TCP proxy over Tart network
- host Docker socket
- host Docker daemon
- image pull and container run
Example:
error during connect: Get "http://192.168.110.1:2375/...": EOF
Usually means:
- the TCP listener accepted the connection
- but
socatcould not reach the Unix socket on the host
Check:
ls -l /var/run/docker.sock
docker ps
tail -f /tmp/host-docker-proxy.logIf you see errors pointing at:
/Users/dev/.docker/run/docker.sock
that path is wrong on this machine.
Use:
/var/run/docker.sockCheck:
launchctl list | grep host-docker-proxy
lsof -iTCP:2375 -sTCP:LISTEN -n -PIf needed, reload:
launchctl unload ~/Library/LaunchAgents/com.scribular.host-docker-proxy.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/com.scribular.host-docker-proxy.plistReset the VM Docker config:
mkdir -p ~/.docker
printf '{}\n' > ~/.docker/config.jsonThen retry:
docker run --rm hello-world- [docker-host-proxy.sh](/Volumes/My Shared Files/scribular/docker-host-proxy.sh)
- [com.scribular.host-docker-proxy.plist](/Volumes/My Shared Files/scribular/com.scribular.host-docker-proxy.plist)