Container¶
Represents a container inside a session.
public sealed class Container : IDisposable
{
public string Id { get; }
public Process InitProcess { get; }
public ContainerState State { get; }
public void Start();
public void Stop(Signal signal, TimeSpan timeout);
public void Delete(DeleteContainerOption option);
public Process CreateProcess(ProcessSettings newProcessSettings);
public string Inspect();
public void Dispose();
}
Notes:
- Start() has no flags parameter.
- If InitProcess.OutputMode is Event or Stream, Start() automatically requests native attach.
- InitProcess is only available when ContainerSettings.InitProcess was configured.
Container.Start()¶
Starts the container and, if configured, attaches the init process handle.
Container.Stop(Signal, TimeSpan)¶
Stops the container with a signal and timeout.
Container.Delete(DeleteContainerOption)¶
Deletes the container.
Container.CreateProcess(ProcessSettings)¶
Creates a secondary process object inside the container.
var execSettings = new ProcessSettings
{
CommandLine = new List<string> { "/bin/sh", "-c", "echo secondary process" },
OutputMode = ProcessOutputMode.Event
};
Process process = container.CreateProcess(execSettings);
Container.Inspect()¶
Returns the raw inspect payload as a string.
Container.Id¶
Returns the container ID string.
Container.InitProcess¶
Gets the configured init process object.
Container.State¶
Gets the current container state.
Container.Dispose()¶
Releases the underlying WinRT container object.