Repository navigation
fix(docker): recognise docker.exe and backslash paths as a direct docker run - #1777
Conversation
…ker run The user-supplied docker run check matched only "docker" or a path ending in "/docker". A Windows config naming docker.exe, or the CLI by its backslash path, fell through to the plain shell wrap: config env was never injected as -e flags (the container did not see it), no cidfile was written, and the server was not treated as docker for container cleanup. Match the base name in either separator style, case-insensitively, with or without .exe.
9c909a3 to
28cc369
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
… docker run Review follow-up: recognising docker.exe and backslash paths routes such commands through resolveDockerSpawn, which resolved docker on its own and dropped an explicit C:\custom\docker.exe (or /opt/x/bin/docker), failing when that docker was not on PATH or running a different one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_dir Sol review round 2 of smart-mcp-proxy#1777: ./bin/docker or .\bin\docker.exe still fell through to the resolver. A path with a separator is now evaluated like exec does (against working_dir, else the process directory); a bare name stays a PATH lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gured docker Sol review round 3 of smart-mcp-proxy#1777: ./server + ./bin/docker joined to a relative path that isDirectExecutable rejects, so the resolver's docker won again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oss Windows drives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged. Thank you, @rudycelekli! A direct Contributions like this are what keep MCPProxy moving, and they matter a lot to the project. One small ask, only if you feel like it: a short public note about your change (a tweet, a LinkedIn post, a line in a community you are part of) helps more people discover MCPProxy. No pressure at all, and I would be glad to repost it. |
Problem
connectStdioand the launcher path decide whether an upstream is a user-supplieddocker runwith:On Windows the command is often
docker.exeor a backslash path such asC:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe. Neither matches, so the server goes through the plain shell-wrap branch:config.Envisn't injected as-eflags, so the container never sees those variables (API keys etc.). They only reach the docker CLI process.--cidfileis added, andisDockerCommandis false, so the container isn't tracked for cleanup on stop or restart.ensureNoExistingContainersare skipped.Fix
Move the check into
isDockerRunCommand(command, args). It takes the base name after the last/or\\, compares it case-insensitively, and acceptsdockerordocker.exe. All four call sites (stdio and launcher, lock and branch) now use it. Behaviour fordockerand/path/to/dockeris unchanged.Test
TestIsDockerRunCommandcovers bare, POSIX path,docker.exe, upper-case, and both Windows paths, plus negatives (docker ps, no args,docker-compose,dockerize). With the previous predicate the four Windows cases fail; with this change all pass.go test -count=1 ./internal/upstream/core/passes.Made with Cursor