Skip to content

exporter: add src option to local and tar exporters - #7117

Open
alexgwolff wants to merge 1 commit into
moby:masterfrom
alexgwolff:feat/local-exporter-src
Open

exporter: add src option to local and tar exporters#7117
alexgwolff wants to merge 1 commit into
moby:masterfrom
alexgwolff:feat/local-exporter-src

Conversation

@alexgwolff

@alexgwolff alexgwolff commented Sep 4, 2026

Copy link
Copy Markdown

Adds a src option to the local and tar exporters, so a subdirectory of the
build result can be exported without a dedicated scratch stage.

buildctl build ... --output type=local,dest=./out,src=/usr/src/app/reports

The contents of src land at the root of the destination. Symlinks are resolved
within the build result via fs.RootPath, so an absolute symlink in the image
cannot escape to the daemon's filesystem.

src takes a single literal path, so the glob patterns raised in the issue are
not covered

related #874

Adds a `src` option to the local and tar exporters, so a subdirectory of the
build result can be exported without a dedicated scratch stage.

    buildctl build ... --output type=local,dest=./out,src=/usr/src/app/reports

The contents of `src` land at the root of the destination. Symlinks are resolved
within the build result via `fs.RootPath`, so an absolute symlink in the image
cannot escape to the daemon's filesystem.

`src` takes a single literal path, so the glob patterns raised in the issue are
not covered. Two further cases are deliberately left out and can follow up
depending on what you prefer: an empty `src=` combined with `mode=delete`, and
`src` pointing at a single file rather than a directory.

Updates moby#874

Signed-off-by: Alex G. Wolff <13754094+alexgwolff@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant