Repository navigation
fix: Accept the npipe:////SERVER/pipe/NAME endpoint form - #137
Merged
HofmeisterAn merged 2 commits intoNov 30, 2026
Merged
Conversation
Docker documents the Windows named pipe endpoint for DOCKER_HOST as npipe:////SERVER/pipe/NAME, for example npipe:////./pipe/docker_engine (equivalent to \SERVER\pipe\NAME). System.Uri parses this form with an empty host and a path that does not match the three-segment layout the named pipe transport expects, so endpoints in this form were refused with "The endpoint is not a npipe URI.". Read the pipe server and pipe name from the endpoint's original string for this form, next to the existing npipe://SERVER/pipe/NAME parsing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Docker documents the Windows
DOCKER_HOSTnamed pipe endpoint asnpipe:////./pipe/NAME(e.g.npipe:////./pipe/docker_engine, equivalent to\\.\pipe\NAME), and Docker Desktop writes this form into its contexts.DockerHandlerFactoryrefused exactly this form withSystem.InvalidOperationException: The endpoint is not a npipe URI., so any tool passing a context endpoint on asDOCKER_HOST(including Testcontainers) broke, while the Docker CLI requires precisely this form.Root cause
System.Uriparsesnpipe:////SERVER/pipe/NAMEwith an emptyUri.Hostand a path whose segments do not match the three-segment layout (/,pipe/,NAME) thatDockerHandlerFactoryrequired. On .NET 10 the.server is additionally dropped from the segments as a dot segment, so the server cannot be recovered fromUriat all.The fix
DockerHandlerFactorynow reads the pipe server and pipe name (the\\SERVER\pipe\NAMEcomponents) via a newTryParsePipeEndpoint: thenpipe://SERVER/pipe/NAMEpath is unchanged (localhoststill maps to.), and for the documentednpipe:////SERVER/pipe/NAMEshape the components are read from the endpoint's original string. Malformed endpoints (missing/empty server or pipe name, multi-segment pipe names) still throw"The endpoint is not a npipe URI.".How tested
Tests were run by an AI coding agent (no Docker daemon needed; these are pure URI-parsing unit tests) using a user-scoped .NET SDK 10.0.404:
CreateHandler_AcceptsDockerDocumentedNamedPipeEndpointsfailed for all three four-slash endpoints withThe endpoint is not a npipe URI.before the fix (3 failed / 9 passed).Docker.DotNet.TestsV2suite 47/47 per TFM on net8.0, net9.0 and net10.0 (six tests that compare against thedockerCLI were not run locally because it is not installed; they are unchanged and covered by CI). New coverage: acceptance of both forms, exact server/pipe-name extraction (.,localhost, remote, case-insensitive), malformed-form rejection, and an end-to-endDOCKER_HOST=npipe:////./pipe/docker_engine→DockerConfig→ named pipe transport test. All target frameworks (net8.0/net9.0/net10.0/netstandard2.0/netstandard2.1) build without errors, anddotnet format --verify-no-changespasses.Fixes #135
This was written with help from an AI coding assistant.