Skip to content

WSL.Container API for existing containers #40990

Description

@hultqvist

Is your feature request related to a problem? Please describe.
While testing the new SDK the program crashed.
Next time it failed to create the container because one with that name already existed.
Right now it does not appear that there is a way to manage already existing containers.

container = session.CreateContainer(containerSettings);

Describe the solution you'd like
Any of the following:

session.GetContainers();
container = session.OpenContainer(...);
new ContainerSettings
{
    ReplaceIfExist = true,
}

Describe alternatives you've considered

The alternative right now is to clear up the container using wslc.exe

RunCommand("wslc.exe", $"--session {SessionName} stop {ContainerName}");
RunCommand("wslc.exe", $"--session {SessionName} rm {ContainerName}");

Additional context
Add any other context or screenshots about the feature request here.

NuGet: Microsoft.WSL.Containers 2.9.3
wslc 2.9.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions