Skip to content

fix: route DMR through the selected Docker connection safely - #4481

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:worktree-board-14182803df41cd7e
Sep 30, 2026
Merged

dgageot merged 1 commit into
docker:mainfrom
dgageot:worktree-board-14182803df41cd7e

Conversation

@dgageot

@dgageot dgageot commented Sep 28, 2026

Copy link
Copy Markdown
Member

DMR (Docker Model Runner) commands were resolving the CLI connection independently for discovery, status, inspect, and pull, instead of reusing the context/host/config/TLS settings the root command already selected. On Docker Desktop that selection can point at a remote engine reached through docker system dial-stdio, so falling back to a hardcoded local socket silently talked to the wrong daemon, and the effective context could also drift if it were re-resolved after --working-dir changed the process directory.

This change threads the resolved connection through the DMR code paths: discovery, status, inspect, and pull now issue docker system dial-stdio for whatever context/host the CLI picked, and the API server carries that connection on its request context so it stays stable across reconnects rather than being re-derived per request. Config, TLS, and socket paths are anchored to absolute locations before use, and the effective context is pinned early, before --working-dir can change the working directory out from under later resolution. As a side effect, we stop offering to delete local partial downloads when the connection may be remote, since that partial file belongs to a different engine and deleting it would be unrelated cleanup at best.

Coverage: task dev (build, full test suite, lint) passed, plus a targeted race run, go test -race ./cmd/root -run '^TestDMR' -count=1. New regression tests exercise the connection propagation in cmd/root/dmr_test.go, pkg/model/provider/dmr/dmrmodels/resolve_test.go, pkg/model/provider/dmr/pull_test.go, and pkg/server/server_test.go, and docs/providers/dmr/index.md documents the new behavior. This has been validated locally and with automated tests only; live reproduction against Docker Desktop 4.93 has not been verified, so I can't yet confirm the original symptom is 100% reproduced or resolved in that setup.

@dgageot
dgageot requested a review from a team as a code owner September 28, 2026 16:37
@aheritier aheritier added area/cli CLI commands, flags, output formatting area/docs Documentation changes area/providers/docker-model-runner Docker Model Runner (DMR) local inference kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Sep 28, 2026
@dgageot
dgageot force-pushed the worktree-board-14182803df41cd7e branch from 6868892 to bbde8ab Compare September 30, 2026 06:11
Discovery, status, inspect, and pull now go through `docker system
dial-stdio` for whatever context/host the CLI resolved, instead of a
hardcoded local socket, and the API server keeps that connection on
its request context. Config/TLS/socket paths are anchored and the
effective context is pinned before --working-dir changes the process
directory, and we stop offering to delete local partial downloads
when the connection may be remote.

Also fixes the TLS-flag-forwarding test to use a native temp dir for
the cert/key paths instead of hardcoded absolute paths, so it passes
on any platform.

Assisted-By: docker-agent
Signed-off-by: David Gageot <david.gageot@docker.com>
@dgageot
dgageot force-pushed the worktree-board-14182803df41cd7e branch from bbde8ab to eb71147 Compare September 30, 2026 06:12
@dgageot
dgageot added this pull request to the merge queue Sep 30, 2026
Merged via the queue into docker:main with commit d298eba Sep 30, 2026
22 checks passed
@dgageot
dgageot deleted the worktree-board-14182803df41cd7e branch September 30, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands, flags, output formatting area/docs Documentation changes area/providers/docker-model-runner Docker Model Runner (DMR) local inference kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants