Add secrets/configs driver: copy, for use with a remote Docker host - #14189
Closed
NAVEENKUMARKR777 wants to merge 1 commit into
Closed
Add secrets/configs driver: copy, for use with a remote Docker host#14189NAVEENKUMARKR777 wants to merge 1 commit into
NAVEENKUMARKR777 wants to merge 1 commit into
Conversation
secrets.<name>.file and configs.<name>.file are interpreted as a path on the Docker host: Compose bind-mounts that host path into the container. This breaks entirely once DOCKER_HOST or a docker context points at a remote engine, since Compose is a client-side tool and cannot bind-mount a path that only exists on the client's machine into a remote container. This has been open since 2024 with three separate community PRs (docker#11871/docker#12251, docker#11984/docker#12448, docker#12625) rejected for the same reason: they switched the behavior unconditionally based on `file:` being set, which the maintainer flagged as a breaking change for users who rely on the existing bind mount (editing the file on the Docker host directly, or `watch`-driven sync) - see the review comment on docker#12448. Add driver: copy as the explicit opt-in the maintainer asked for: when set, the secret/config's file is read from the CLIENT's local filesystem and copied into the container (reusing the existing content-injection path already used for `content:`), instead of bind-mounted. Without driver: copy, behavior is completely unchanged. Any other driver value is still rejected, as before. Closes docker#11867 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Naveenkumar <naveenkumarkr555@gmail.com>
Contributor
|
This account has been blocked after review: it opened a burst of near-identical, AI-generated PRs across many unrelated projects in a very short window, without real review or testing behind them, not a comment on AI-assisted contributions in general, which are welcome here when disclosed and reviewed. |
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.
Summary
This has been open since May 2024 with 50+ comments and three separate community PRs (#11871/#12251 by @andoks, #11984/#12448 by @schaubl, and the narrower #12625) all closed without merging. The problem:
secrets.<name>.file/configs.<name>.fileare interpreted as a path on the Docker host, so Compose bind-mounts it into the container — which breaks entirely onceDOCKER_HOST/a docker context points at a remote engine, since Compose is a client-side tool and cannot bind-mount a path that only exists on the client.Every prior attempt switched the behavior unconditionally based on
file:being set, and was rejected for the same reason each time. From @ndeloof's review on #12448:This PR adds exactly that:
driver: copyas an explicit opt-in.When set, the file is read from the client's local filesystem and copied into the container once, at creation — reusing the content-injection path Compose already has for
content:-based secrets/configs (copyFileToContainer/createTar) — instead of bind-mounted. Withoutdriver: copy, behavior is completely unchanged: existing users who rely on the bind mount (editing the file on the Docker host directly, orwatch-driven sync) are unaffected. Any otherdrivervalue is still rejected, as before.New doc page:
docs/secrets-and-configs-driver-copy.md.Test plan
go test ./pkg/compose/...— new unit tests forresolveFileContent's copy-driver path and precedence (Content/Environmentstill win), and for the bind-mount-skip/validation logic inbuildContainerSecretMounts/buildContainerConfigMountsgolangci-lint run --build-tags e2e ./...— 0 issuesTestSecretCopyDriver) added but not run in this environment — no Docker daemon available. It specifically verifies the copy is a one-time snapshot (editing the client's file afterupdoes not reach the running container), the key behavioral difference from a bind mount. Please rungo test -tags e2e ./pkg/e2e/ -run TestSecretCopyDriverbefore merging.Closes #11867
🤖 Generated with Claude Code