# WinContainers — Components & Modules
Artificial Intelligence

# WinContainers — Components & Modules

Component list from Wincontainer

Jan Petersen
June 10, 2026
8 min read
6 views
ProjectPurpose
WinContainers.AppWinUI 3 GUI — single self-contained .exe
WinContainers.CoreModels, interfaces (IRuntimeDriver, IContainerStateProvider, IAppStore)
WinContainers.ServiceASP.NET Core minimal API (in-process Kestrel), PSRunner, StreamHostRegistry
WinContainers.ScriptsEmbedded PowerShell scripts + ScriptManifest.json
WinContainers.Tests.UnitxUnit unit tests
WinContainers.Tests.IntegrationIntegration tests ([Trait("wslc", "required")], skips cleanly)
WinContainers.Tests.PlaywrightWebView2 terminal pane UI tests

2. Runtime & Container Layer

ModuleRole
WSLC (wslc.exe)Microsoft WSL Containers CLI — primary runtime driver
wslcsession.exePer-user Windows service that hosts the WSLC runtime
WSL2Linux kernel hosting layer for WSLC containers

3. PowerShell Scripting Layer

ComponentExecution modeDescription
PowerShell.Create()One-shot (~50 ms)Used for list/start/stop/pull/inspect/create calls
pwsh.exe child processStreaming (ConPTY)Used for logs -f, exec sessions, and the interactive terminal
ScriptProviderStartupMaterializes embedded .ps1 resources to %APPDATA%\WinContainers\Scripts\ on first run
StreamHostRegistryRuntimeTracks long-lived pwsh.exe processes; supports cancellation
ScriptManifest.jsonConfigurationMaps script name → type (one-shot/stream) → wslc command with timeout

Scripts managed:

ScriptTypewslc commandTimeout
Get-Containerone-shotwslc container ps --format json30 s
Start-Containerone-shotwslc container start {id}30 s
Stop-Containerone-shotwslc container stop {id}30 s
Restart-Containerone-shotwslc container restart {id}30 s
Remove-Containerone-shotwslc container rm {id}30 s
Get-Imageone-shotwslc image ls --format json30 s
Pull-Imagestreamwslc image pull {image}30 min
Remove-Imageone-shotwslc image rm {id}30 s
Get-Volumeone-shotwslc volume ls --format json30 s
New-Volumeone-shotwslc volume create {name}30 s
Remove-Volumeone-shotwslc volume rm {name}30 s
Get-Networkone-shotwslc network ls --format json30 s
New-Networkone-shotwslc network create {name}30 s
Remove-Networkone-shotwslc network rm {name}30 s
Get-ContainerLogsone-shotwslc logs --tail {tail} {id}30 s
Start-ContainerLogsStreamstreamwslc logs -f {id}
Exec-Containerstreamwslc exec -it {id} pwsh
Login-Registryone-shotwslc login {host} --username {u} --password-stdin30 s
Verify-Wslcone-shotwslc --version10 s

4. GUI Layer (WinUI 3)

Screens / Pages

ScreenFeatureDescription
Onboarding wizardF14-card wizard detecting WSL, virtualization, Insider status, WSL Preview
DashboardF2Container list with status badges; polls wslc container ps every 2 s
ImagesF4Image list + pull dialog + delete + inspect
VolumesF7Volume list + create + inspect + delete
NetworksF8Network list + create + inspect + delete
SettingsF10Theme, terminal font size, registry list, startup behaviour
Terminal tabF5, F11Real ConPTY-backed pwsh.exe via xterm.js in WebView2
Logs viewerF6Live tail + 500-line history
Activity panelF11Real-time stream of every wslc call with status

WinUI 3 Controls used

ControlUsage
NavigationViewPrimary app shell navigation
ItemsRepeaterVirtualized container cards on Dashboard
ContentDialogPull image dialog, confirmations, registry login
WebView2xterm.js terminal pane
InfoBarStatus notifications for actions
ProgressBar / ProgressRingLoading/pull progress
AutoSuggestBoxImage name autocomplete in pull dialog
TextBoxSettings fields
ToggleSwitchSettings toggles
CommandBarAction buttons on list pages
Grid / StackPanelGeneral page layout
BorderCard styling
AcrylicBrush / MicaBackdropFluent Design background

5. Service Layer (In-process ASP.NET Core)

ComponentDescription
KestrelHTTP server bound to 127.0.0.1:<random port>
Bearer token auth128-bit token generated per launch; written to %LOCALAPPDATA%\WinContainers\service.token
PSRunnerAbstracts PowerShell.Create() one-shots and pwsh.exe streaming processes
StreamHostRegistryIn-memory registry of active streaming processes; supports Cancel(streamId)
ScriptProviderReads ScriptManifest.json, resolves embedded .ps1 resources
Health endpointGET /api/health{ wslcOk, wslcVersion, appVersion }

REST API endpoints

MethodPathPurpose
GET/api/containersList containers
POST/api/containers/{id}/startStart container
POST/api/containers/{id}/stopStop container
POST/api/containers/{id}/restartRestart container
DELETE/api/containers/{id}Remove container
POST/api/containers/{id}/execSpawn exec session → { streamId }
GET/api/containers/{id}/logs?tail=500Get log lines
GET/api/containers/{id}/logs/streamWS live log tail
GET/api/imagesList images
POST/api/images/pullPull image → stream
DELETE/api/images/{id}Remove image
GET/api/volumesList volumes
POST/api/volumesCreate volume
DELETE/api/volumes/{name}Remove volume
GET/api/networksList networks
POST/api/networksCreate network
DELETE/api/networks/{name}Remove network
GET/api/registriesList configured registries
POST/api/registriesAdd registry (secret → Credential Manager)
DELETE/api/registries/{host}Remove registry
GET/api/settingsGet app settings
PUT/api/settingsUpdate app settings
GET/api/healthHealth check

WebSocket endpoints

PathDirectionMessages
/ws/eventsserver → clientcontainer.snapshot every 2 s + container.event on state change
/ws/terminalbidirectionalterminal.in, terminal.out, terminal.resize
/ws/stream/{streamId}server → clientstream.line, stream.closed

6. Persistence

ComponentTechnologyStores
IAppStoreSystem.Text.Json%APPDATA%\WinContainers\*.jsonApp settings, registry metadata
Windows Credential ManagerCredentialManagement NuGetRegistry passwords/tokens
Service port/token filePlain text (ACL'd)%LOCALAPPDATA%\WinContainers\service.{port,token}
LogsSerilog rolling file%LOCALAPPDATA%\WinContainers\logs\app-YYYYMMDD.log

7. NuGet Packages

PackageVersionUsed by
Microsoft.WindowsAppSDK1.8+App (WinUI 3)
Microsoft.PowerShell.SDK7.4+Service (PSRunner)
Pty.NetlatestService (ConPTY)
Serilog.AspNetCorelatestService
Serilog.Sinks.FilelatestService
CredentialManagementlatestService
System.Text.Jsonbuilt-inCore / Service
xunitlatestAll test projects
FluentAssertionslatestUnit + Integration tests
NSubstitutelatestUnit tests
PlaywrightlatestPlaywright tests
VelopacklatestApp (auto-update)

8. CI/CD & Distribution

ComponentRole
GitHub Actions (ci.yml)Build, test (unit + integration + Playwright), dotnet format --verify-no-changes
GitHub Actions (release.yml)Publish → Velopack pack → SignPath sign → gh release create → WinGet PR
GitHub Actions (codeql.yml)Weekly C# CodeQL analysis
Dependabot (dependabot.yml)Weekly NuGet + Actions updates
SignPath.ioFree OSS code signing of all released binaries
VelopackAuto-update framework (Squirrel.Windows successor)
WinGetCommunity manifest for winget install WinContainers
GitHub ReleasesDistribution channel for signed installer + delta + portable .exe

9. Architecture Interfaces (Core)

InterfacePurpose
IRuntimeDriverAbstraction over WSLC; swapable for containerd+nerdctl in future
IContainerStateProviderAbstraction for live container state; upgrade path for future events/stats API
IAppStoreGeneric JSON persistence; upgrade path for SQLite in v2
StreamHostRegistryRegistry + lifecycle for streaming pwsh.exe child processes

10. Architecture Patterns

PatternImplementation
MVVMWinUI 3 data binding with x:Bind, ViewModels decoupled from Microsoft.UI.Xaml.*
DIMicrosoft.Extensions.DependencyInjection via ASP.NET Core host builder
In-process hostingASP.NET Core WebApplication hosted inside WinUI 3 App.OnLaunched
Bearer token authPer-launch 128-bit random token; validated on every API request
Poll + pushDashboard polls every 2 s; WebSocket events for real-time terminal I/O
Embedded resources.ps1 scripts compiled as resources; extracted on first run

Share this post

Related Posts

Comments

Be the first to leave a comment.

Leave a comment

Comments are reviewed before they appear.