Skip to content

Docker Desktop not detected on macOS: servers fail with command not found: docker despite docker_available: true #696

Closed

Description

@algis-dumbris

Summary

On a stock macOS machine with Docker Desktop installed and running, mcpproxy cannot launch any Docker-based upstream server. The spawned process fails with zsh:1: command not found: docker, even though:

  • Docker Desktop is installed (/Applications/Docker.app)
  • The Docker daemon is running (socket present at ~/.docker/run/docker.sock)
  • mcpproxy's own status reports docker_available: true / global_enabled: true

The root cause is that a default Docker Desktop install does not place the docker CLI on a standard PATH directory. The binary lives inside the app bundle:

/Applications/Docker.app/Contents/Resources/bin/docker

Docker Desktop only symlinks it into /usr/local/bin if the user opts into "install CLI tools" (which requires admin privileges). mcpproxy spawns upstream servers with a sanitized PATH that does not include the app-bundle bin directory, so docker is unresolvable at spawn time.

This makes Docker isolation / Docker-based servers fail out-of-the-box for any user who installed Docker Desktop the default way.

Environment

  • mcpproxy: v0.39.0 (personal), darwin/arm64
  • macOS: 26.5.1 (arm64, Apple Silicon)
  • Docker Desktop CLI: Docker version 29.5.3, build d1c06ef (resolvable only via full path)
  • command -v docker → NOT FOUND (no symlink in /usr/local/bin or /opt/homebrew/bin)

PATH mcpproxy uses when spawning servers (from logs):

/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

Note /Applications/Docker.app/Contents/Resources/bin is absent.

Steps to reproduce

  1. Fresh macOS machine. Install Docker Desktop the default way (do not run the optional "install CLI tools" / privileged helper step). Start Docker Desktop.
  2. Confirm the daemon is up but the CLI is not on PATH:
    • ls ~/.docker/run/docker.sock → exists
    • command -v docker → not found
    • /Applications/Docker.app/Contents/Resources/bin/docker --version → works
  3. Add a Docker-based upstream server, e.g. a server whose command is docker run --rm -i … <image>.
  4. Observe it never connects.

Expected

mcpproxy either:

  • discovers Docker Desktop's bundled CLI path automatically and uses it, or
  • surfaces a clear, actionable error ("Docker CLI not found on PATH — install Docker Desktop CLI tools or add /Applications/Docker.app/Contents/Resources/bin to PATH") instead of a raw repeated command not found.

And docker_available should reflect whether the docker binary is actually resolvable on the spawn PATH, not just whether Docker is configured/enabled.

Actual

  • Server stays in Error state, retrying (observed retry_count: 21).
  • last_error / health detail is a wall of repeated:
    failed to connect: stdio transport (command="docker", docker_isolation=true):
    server process exited before completing the MCP initialize handshake; recent stderr:
      | zsh:1: command not found: docker
      | zsh:1: command not found: docker
      | ... (repeated ~20x)
    
  • Meanwhile upstream_servers list reports "docker_status":{"available":true,"global_enabled":true,...} and per-server "docker_available":true — which is misleading, since the CLI is not actually invocable.

Suggested fixes

  1. PATH enhancement / Docker discovery: when resolving docker, also probe well-known Docker Desktop locations, especially /Applications/Docker.app/Contents/Resources/bin on macOS (and the equivalent on Windows/Linux). If found, prepend it to the spawn PATH or invoke via absolute path.
  2. Accurate availability check: make docker_available test actual binary resolvability on the PATH used for spawning (e.g. exec.LookPath("docker") against that PATH), not just config/daemon presence.
  3. Better diagnostics: detect command not found: <cmd> from spawn stderr and replace the repeated raw output with a single actionable message pointing the user to install/symlink the CLI; consider de-duplicating the repeated stderr lines and capping retries with a clearer terminal error.

Workaround (for other users hitting this)

Symlink the bundled CLI into a PATH dir mcpproxy already uses, e.g.:

ln -sf "/Applications/Docker.app/Contents/Resources/bin/docker" /opt/homebrew/bin/docker

(or enable Docker Desktop's "Install CLI tools" so it symlinks into /usr/local/bin), then restart the affected servers.

Activity

  1. algis-dumbris commented on Jun 17, 2026

    @algis-dumbris
    ContributorAuthor

    Update: v0.39.1 — partially fixed, core issue remains

    Tested on mcpproxy v0.39.1 (darwin/arm64, macOS 26.5.1, Docker Desktop 29.5.3), with the docker CLI still not on the user PATH (no symlink in /usr/local/bin or /opt/homebrew/bin).

    ✅ Improved

    • Detection added: upstream_servers list now reports the bundled CLI:
      "docker_status": { "available": true, "docker_path": "/Applications/Docker.app/Contents/Resources/bin/docker", ... }
    • Actionable error instead of a raw dump:

      Docker CLI not found on PATH. Install Docker Desktop CLI tools, or it is bundled at /Applications/Docker.app/Contents/Resources/bin/docker — restart the affected servers.

    • Repeated stderr collapsed: command not found: docker (repeated 7×).

    ❌ Still broken (the core bug)

    Docker-based servers still fail to start. mcpproxy now discovers docker_path but does not use it when spawning the server — it still invokes bare docker, which is unresolvable on the spawn PATH:

    failed to connect: stdio transport (command="docker", docker_isolation=true):
    server process exited before completing the MCP initialize handshake; recent stderr:
    Docker CLI not found on PATH. Install Docker Desktop CLI tools, or it is bundled at
    /Applications/Docker.app/Contents/Resources/bin/docker — restart the affected servers.
      | zsh:1: command not found: docker (repeated 7×): transport error: transport closed
    

    Both jira-gcore and slack-gcore remain in Error state.

    Ask

    Please wire the discovered docker_path into the actual spawn — either invoke docker by its absolute path, or prepend its directory (/Applications/Docker.app/Contents/Resources/bin) to the PATH used to launch upstream servers. Right now detection + diagnostics are correct, but the spawn path isn't using them, so the failure persists.

    Manual workaround still required:

    ln -sf "/Applications/Docker.app/Contents/Resources/bin/docker" /opt/homebrew/bin/docker
  2. 5 remaining items

  3. algis-dumbris commented on Jun 18, 2026

    @algis-dumbris
    ContributorAuthor

    Debug-level trace: the user-supplied docker command path is still shell-wrapped with bare docker (v0.41.0)

    Reproduced on v0.41.0 with logging.level=debug. For upstream servers whose command is docker (e.g. docker run … <image>), mcpproxy resolves the bundled CLI for status (docker_path is correct) but the spawn is unconditionally shell-wrapped with bare docker — the resolved absolute path is never substituted in. The #703 direct-exec fix does not cover this path.

    Exact spawned process (core/connection.go → Initialized stdio transport, secrets redacted):

    final_command: "/bin/zsh"
    final_args:    ["-l", "-c", "docker run --cidfile /var/folders/…/mcpproxy-cid-*.txt
                     -e CONFLUENCE_URL=… -e JIRA_PERSONAL_TOKEN=*** …
                     --rm -i … ghcr.io/sooperset/mcp-atlassian:latest"]
    docker_isolation: true
    

    Relevant decision lines:

    • core/connection.go — Docker command detected, setting up container ID tracking
    • core/connection_stdio.go:391 — shellwrap: wrapping command with user login shell … "shell":"/bin/zsh"
    • core/connection_stdio.go:175 — Wrapping command with user shell for full environment inheritance
    • transport/stdio.go:203 — Process group configuration applied … "command":"/bin/zsh","args":["-l","-c","docker run …"]

    And the login-shell hydration that #703's gate depends on captured no docker-bearing PATH and no DOCKER_*:

    mcpproxy/main.go:512 | shellwrap: hydrated login-shell environment for GUI/launchd launch
      | {"keys": ["HOMEBREW_PREFIX", "PATH"], "count": 2}
    

    So /bin/zsh -l -c "docker …" runs with a login-shell PATH that has no docker (Docker Desktop bundle dir absent) → zsh:1: command not found: docker.

    Ask

    When the upstream command is docker (not just the isolation-injected case), substitute the verified absolute docker path into the wrapped command (or direct-exec it), instead of emitting bare docker into $SHELL -l -c. Right now resolution succeeds for the status field but is ignored at spawn time on this path.

    Env: mcpproxy v0.41.0, macOS 26.5.1 (arm64), Docker Desktop 29.5.3, docker not symlinked onto PATH.

  4. Dumbris commented on Jun 18, 2026

    @Dumbris
    Member

    Fixed in #714 (merged to main as 5cc9eee). User-supplied docker run upstreams now go through the same resolve→direct-exec decision as the isolation path (resolveDockerSpawn): on macOS the resolved absolute Docker Desktop bundle binary (/Applications/Docker.app/Contents/Resources/bin/docker) is exec'd directly instead of shell-wrapping bare docker, so it no longer fails with zsh:1: command not found: docker when the CLI isn't on the login-shell PATH. Will ship in the next release.

  5. algis-dumbris commented on Jun 18, 2026

    @algis-dumbris
    ContributorAuthor

    Confirmed fixed in v0.41.1 — docker-command upstreams (jira-gcore, slack-gcore) connect with the docker CLI resolved by absolute path, verified with docker still NOT on PATH (no symlink), macOS 26.5.1, Docker Desktop 29.5.3. The credential-helper follow-on (#715) is also fixed in v0.41.2. Thanks for the fast turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions