Posted in

WSL Container SDK — Embed Linux Containers Inside Native Windows Apps

🔹 Feature: WSL Container SDK — Embed Linux Containers Inside Native Windows Apps
🔹 What It Does: Native SDK that lets any Windows EXE start, run, and control Linux containers under the hood — the user just launches a regular Windows program.

What It Is Giving You:

✅ Windows Program on the Surface, Linux Container Underneath: Ship one Windows EXE (or MSI, MSIX, WinGet package). The end user double-clicks it like any other Windows app. Behind the scenes, your app spins up a lightweight WSL session, pulls or loads a container image, starts the container, runs the Linux workload, and streams stdout/stderr back to your Windows UI. Zero container tooling for the user to install.
✅ Three Language Projections: C via wslcsdk.h / wslcsdk.lib / wslcsdk.dll; C++ via Microsoft::WSL::Containers; C# via Microsoft.WSL.Containers. Pick the language your Windows app is already written in.
✅ Clean Layered API — Session → Container → Process: Create a Session (CPU count, memory, VHD, timeout), start a Container inside it (image, hostname, port mappings, volumes, named volumes, networking mode), then run one or more Processes inside the container (cmdline, working directory, env vars, I/O callbacks, exit callbacks). Same model across all three languages.
✅ Full Image Lifecycle From Your Code: Pull from an OCI registry, Import from a tar archive, Load from a file, Tag, Push, List, Delete — all from your Windows app. No docker pull on the user’s machine.
✅ Auto-Install WSL Dependencies: WslcGetMissingComponents + WslcInstallWithDependencies let your installer detect what’s missing on the target machine and install only the required WSL components. The user never sees “please install WSL first.”
✅ Networking + Storage Control: Configure NAT/bridged/host networking, forward TCP/UDP ports back to Windows, mount host directories or WSL VHD-backed named volumes into the container. Standard container primitives, exposed through a Windows-native API.
✅ Real Lifecycle Events: Callbacks for stdio, process exit, session crash dumps, and image-pull progress. Wire them into your Windows UI to show real progress bars, log streams, and error dialogs — not just a spinning cursor.
✅ Bundled Command-Line: The same underlying capability ships as wslc.exe for scripting, ops tooling, and quick prototyping — before you commit to embedding the SDK in your app.

What This Unlocks:

🔸 Ship AI inference apps that run a Linux model server inside the EXE — no Docker Desktop, no manual WSL setup.
🔸 Package Linux-only tooling (Kafka, PostgreSQL, Redis, custom Go/Rust binaries) as a single-EXE Windows product.
🔸 Cross-platform apps where the compute-heavy or POSIX-dependent path lives in a container while the UI is native Windows.
🔸 Enterprise line-of-business apps where a single installer replaces a documented “install WSL, install Docker, run this docker-compose” onboarding.

🌐 https://wsl.dev/api-reference/
🌐 https://learn.microsoft.com/windows/wsl/

#mvpbuzz #azurenews #WSL #Windows #Containers #DeveloperTools #SDK #dotnet #Cpp #C #mctbuzz #msignite

Microsoft Certified Trainer, Office 365, AWS, Azure and Cloud Expert-Architect. In the IT world for over than 20 years.

Apart from the main area of Microsoft Azure expert in the field of infrastructure servers Windows Server 2003-2019, Microsoft Active Directory, Hyper-V Private Cloud, IIS, System Center, SQL.

Private Cloud, System Center, Hyper-V, Open Stack Expert and all Microsoft products Expert. Linux Server administrator.

My Azure community projects:

https://mazeball.azurewebsites.net/
https://github.com/MariuszFerdyn?tab=repositories

More

Leave a Reply

Your email address will not be published. Required fields are marked *