Tools.Windows.DockerOrchestrator
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Tools.Windows.DockerOrchestrator --version 1.0.0
NuGet\Install-Package Tools.Windows.DockerOrchestrator -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tools.Windows.DockerOrchestrator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tools.Windows.DockerOrchestrator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Tools.Windows.DockerOrchestrator, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tools.Windows.DockerOrchestrator as a Cake Addin #addin nuget:?package=Tools.Windows.DockerOrchestrator&version=1.0.0 // Install Tools.Windows.DockerOrchestrator as a Cake Tool #tool nuget:?package=Tools.Windows.DockerOrchestrator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Windows.DockerOrchestrator
This is an orchestration API for Docker on Windows platforms. Docker has to be installed for this to function properly.
Table of Contents
- API
- DockerContainerConfig
- DockerContainer
- DockerContainer methods
- Examples
API
This is an API reference for the Windows.DockerOrchestrator library.
DockerContainerConfig
Method | Description |
---|---|
class DockerContainerConfig |
This is the class we will use to configure the container before creating it. |
DockerContainer
Method | Description |
---|---|
class DockerContainer(DockerContainerConfig config) |
This is the main class we will be making operations to. |
DockerContainer methods
Method | Description |
---|---|
bool DockerContainer.Create() |
Creates a new container with specified configuration. Returns wether container was created successfully or not. |
bool DockerContainer.Start() |
Starts the container. Returns wether container was started successfully or not. |
bool DockerContainer.Stop() |
Stops the container. Returns wether container was stopped successfully or not. |
bool DockerContainer.Exists() |
Determines if the container exists and returns the result. |
bool DockerContainer.Delete(bool force = false) |
Deletes the container and returns wether it was successfully deleted or not. |
bool DockerContainer.CopyTo(string machinePath, string remotePath) |
Copies a file or folder from the local machine to the container. |
bool DockerContainer.CopyFrom(string remotePath, string machinePath) |
Copies a file or folder from the container to the local machine. |
string DockerContainer.Execute(string command) |
Executes a command in the container using the container's default command line. |
Examples
This is an example on how to create a container, set up the .NET ecosystem and run an application as a service.
using Windows.DockerOrchestrator;
namespace Windows.DockerOrchestrator.Tests
{
internal class Program
{
static void Main(string[] args)
{
string containerName = "MyApp";
DockerContainer container = new DockerContainer(new DockerContainerConfig
{
Name = containerName,
OperatingSystem = "ubuntu:22.04"
});
container.Create();
if(container.Exists())
{
Console.WriteLine("Created container! Starting...");
container.Start();
if(container.IsRunning())
{
Console.WriteLine("Started container! Running.");
container.Execute("apt-get update");
container.Execute("apt-get install -y apt-utils");
container.Execute("apt-get install -y wget apt-transport-https");
container.Execute("wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb");
container.Execute("dpkg -i packages-microsoft-prod.deb");
container.Execute("rm packages-microsoft-prod.deb");
container.Execute("apt-get install -y dotnet-sdk-8.0");
container.Execute("apt-get install -y systemctl");
container.CopyTo("MyApp", "/MyApp").Log("Copied? ");
container.CopyTo("MyApp.service", "/etc/systemd/system/MyApp.service").Log("Copied? ");
container.Execute("systemctl start MyApp");
container.Execute("systemctl status MyApp");
}
}
Console.WriteLine("Completed.");
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Tools.Webkit (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.