Skip to content

silentorbit/wslc-wrapper

Repository files navigation

WSL Container Wrapper

A wrapper for the wslc.exe command.

Offers a stronly typed interface to generate commands to manage containers on Windows.

Usage

Reference the WslcWrapper.csproj from the git repo or use the NuGet package SilentOrbit.WSLC.

Sample

//Get list of images
List<ImageListItem> list = new ImageList().RunJson();
        
//Create a container from one of the images
new ContainerCreate(image: list[0])
{
    Name = "Hello",
    RM = true, //--rm: Remove the container after it stops
}.Run().ExpectOK();
        
//Start the new container
var resp = new ContainerStart(containerid: "Hello").Run();
        
//Inspect the results
Console.WriteLine($"Result: {resp.ExitCode}");
Console.WriteLine($"Output: {resp.StdOut}");
Console.Error.WriteLine($"Error: {resp.StdErr}");

About

Wrapper for wslc.exe - the WSL Container (Windows Subsystem for Linux)

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages