Skip to content

Expose stdin/stdout/stderr streams for Containers and Executables #6

@karolz-ms

Description

@karolz-ms

Feature description

Users may desire to interact directly with resources. E.g. Aspire dashboard might want to have a terminal emulator that one could attach to a container-based-, or process-based resource and interact directly with it. Or an MCP server with stdio interface might be part of Aspire workload and one would need to access its stdio streams to use it.

Design outline and constraints

  1. Both Executable and Container resource get a flag that enables "attaching to stdio" (stdin + stdout + stderr). When this flag is present, we capture and memorize standard file descriptors for a given resource as it is started.

    Consider if we could enable attaching to stdio for all Executables and Containers

  2. Executable and Container API objects get a stdio subresource. When that subresource is queried, we create and return paths to 3 Unix domain sockets that are attached to relevant resource file descriptors. We also start a proxy that will push data between these sockets and resource file descriptors.

    These paths could also be simply status properties of Executable and Container objects.

  3. Standard output and standard error streams are captured and stored in (raw) temporary files from the moment a resource (with AttachToStdio == true) is started. They are also forwarded to the log writer so the existing log streams continue to work for AttachToStdio == true resources.
  4. When a new client connects to stdout or stderr socket, the existing content is replayed to it.
  5. If more than one client connects to stdin socket, bad things might happen 😄

Additional notes

Related to https://github.com/microsoft/usvc/issues/241

@sebastienros has created a proof-of-concept https://github.com/microsoft/usvc-apiserver/tree/sebros/stdin The details are different from the design outline above, but it illustrates the potential.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-orchestratorAffects DCP usage in Microsoft AspireenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions