Skip to content

wslc build: support tar build contexts from stdin #41629

Closed

Description

Is your feature request related to a problem? Please describe.

wslc build currently requires its positional build context to be a directory. It does not support using - to read a tar build context from standard input:

tar -czf context.tar.gz -C context .
wslc build --tag stdin-context:test - < context.tar.gz

Currently, - is interpreted as a host filesystem path and rejected because it is not a directory.

This prevents tools and pipelines from generating or filtering a build context as a tar stream and passing it directly to WSLC. Callers must instead materialize the context as a temporary directory, adding disk I/O, cleanup, and failure-handling requirements.

This is distinct from --file -, which reads only the Dockerfile from stdin while the build context still comes from a directory.

Describe the solution you'd like

Allow - as the positional build context:

wslc build [OPTIONS] -

When stdin contains a tar archive, use the archive contents as the filesystem build context. The default Dockerfile and .dockerignore should be resolved from the archive root, and --file <path> should resolve the specified Dockerfile relative to that root.

At minimum, uncompressed tar archives should be supported. Ideally, this would match Docker's support for identity, gzip, bzip2, and xz-compressed tar streams.

Invalid archives or an interactive stdin should produce an actionable error. If both the context and --file are -, the command should also report clearly that both inputs cannot consume the same stream.

This would provide behavior equivalent to:

docker build - < context.tar.gz
docker build --file test.Dockerfile - < context.tar.gz

Describe alternatives you've considered

  • Unpack the tar stream into a temporary directory and pass that directory to wslc build. This works, but defeats streaming and requires additional disk space, cleanup, and error handling.
  • Use --file -. This only supplies the Dockerfile through stdin and does not provide the files needed by COPY, ADD, or other context-dependent operations.

Additional context

Docker documents tar build contexts supplied over stdin here:

https://docs.docker.com/build/concepts/context/#local-tarballs

Activity

  1. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

    Once completed please upload the output files to this GitHub issue.

    See Collect WSL logs (recommended method).

    If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

  2. karolz-ms commented on Sep 16, 2026

    @karolz-ms
    Author

    /feature

  3. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor
    Diagnostic information
    Found '/feature', adding tag 'feature'
    
  4. dkbennett commented on Sep 30, 2026

    @dkbennett
    Member

    I thought we did support stdin input, assigning to Gavin to investigate and fix any bugs in this.

  5. ggarzia-MSFT commented on Oct 1, 2026

    @ggarzia-MSFT
    Contributor

    No, we do not currently support this. I will look into implementing this

  6. ggarzia-MSFT commented on Oct 7, 2026

    @ggarzia-MSFT
    Contributor

    Closed here: #41765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions