![]() |
VOOZH | about |
dotnet add package Bielu.Microservices.Orchestrator.Docker --version 0.1.0-beta.639158264724296298
NuGet\Install-Package Bielu.Microservices.Orchestrator.Docker -Version 0.1.0-beta.639158264724296298
<PackageReference Include="Bielu.Microservices.Orchestrator.Docker" Version="0.1.0-beta.639158264724296298" />
<PackageVersion Include="Bielu.Microservices.Orchestrator.Docker" Version="0.1.0-beta.639158264724296298" />Directory.Packages.props
<PackageReference Include="Bielu.Microservices.Orchestrator.Docker" />Project file
paket add Bielu.Microservices.Orchestrator.Docker --version 0.1.0-beta.639158264724296298
#r "nuget: Bielu.Microservices.Orchestrator.Docker, 0.1.0-beta.639158264724296298"
#:package Bielu.Microservices.Orchestrator.Docker@0.1.0-beta.639158264724296298
#addin nuget:?package=Bielu.Microservices.Orchestrator.Docker&version=0.1.0-beta.639158264724296298&prereleaseInstall as a Cake Addin
#tool nuget:?package=Bielu.Microservices.Orchestrator.Docker&version=0.1.0-beta.639158264724296298&prereleaseInstall as a Cake Tool
A .NET library for managing container runtimes (Docker, Podman, containerd, and Kubernetes) through a unified abstraction layer. Write your container-management logic once and swap the underlying runtime with a single line of configuration.
IContainerManager, IImageManager, INetworkManager, IVolumeManager) shared across all runtimesActivity spans around every operationIHealthCheck that verifies the container runtime is reachableMicrosoft.Extensions.DependencyInjection support| Package | Description |
|---|---|
Bielu.Microservices.Orchestrator |
Core abstractions, models, and builder |
Bielu.Microservices.Orchestrator.Docker |
Docker runtime provider |
Bielu.Microservices.Orchestrator.Podman |
Podman runtime provider |
Bielu.Microservices.Orchestrator.Containerd |
containerd runtime provider |
Bielu.Microservices.Orchestrator.Kubernetes |
Kubernetes runtime provider |
Bielu.Microservices.Orchestrator.OpenTelemetry |
OpenTelemetry tracing decorators |
Bielu.Microservices.Orchestrator.HealthChecks |
ASP.NET Core health-check integration |
# Core + Docker (most common)
dotnet add package Bielu.Microservices.Orchestrator
dotnet add package Bielu.Microservices.Orchestrator.Docker
# — or Podman —
dotnet add package Bielu.Microservices.Orchestrator.Podman
# — or Kubernetes —
dotnet add package Bielu.Microservices.Orchestrator.Kubernetes
# — or containerd —
dotnet add package Bielu.Microservices.Orchestrator.Containerd
using Bielu.Microservices.Orchestrator.Extensions;
using Bielu.Microservices.Orchestrator.Docker.Extensions;
builder.Services.AddMicroservicesOrchestrator(orchestrator =>
{
orchestrator.AddDocker(); // uses default Docker socket
});
Each provider exposes an options delegate for custom configuration:
orchestrator.AddDocker(options =>
{
// Linux / macOS default: unix:///var/run/docker.sock
// Windows default: npipe://./pipe/docker_engine
options.Endpoint = "tcp://remote-host:2376";
});
IContainerOrchestrator and use itusing Bielu.Microservices.Orchestrator.Abstractions;
public class MyService(IContainerOrchestrator orchestrator)
{
public async Task RunAsync()
{
// Check the runtime is reachable
var available = await orchestrator.IsAvailableAsync();
// List running containers
var containers = await orchestrator.Containers.ListAsync();
}
}
The IContainerManager interface (exposed via orchestrator.Containers) provides the full create → start → stop → remove workflow.
using Bielu.Microservices.Orchestrator.Models;
var containerId = await orchestrator.Containers.CreateAsync(new CreateContainerRequest
{
Image = "nginx:latest",
Name = "my-nginx",
Ports = [new PortMapping { ContainerPort = 80, HostPort = 8080 }],
EnvironmentVariables = new Dictionary<string, string>
{
["NGINX_HOST"] = "localhost"
},
Labels = new Dictionary<string, string>
{
["app"] = "demo"
}
});
Set Replicas to create multiple container instances from the same configuration.
Each instance is named with a numeric suffix (e.g., my-nginx-0, my-nginx-1) and
labeled with orchestrator.group for grouping.
var firstContainerId = await orchestrator.Containers.CreateAsync(new CreateContainerRequest
{
Image = "nginx:latest",
Name = "my-nginx",
Replicas = 3 // creates my-nginx-0, my-nginx-1, my-nginx-2
});
await orchestrator.Containers.StartAsync(containerId);
// Graceful stop (waits up to 30 s for the process to exit)
await orchestrator.Containers.StopAsync(containerId, timeout: TimeSpan.FromSeconds(30));
var logs = await orchestrator.Containers.GetLogsAsync(containerId, stdout: true, stderr: true);
// Remove a stopped container
await orchestrator.Containers.RemoveAsync(containerId);
// Force-remove a running container
await orchestrator.Containers.RemoveAsync(containerId, force: true);
var info = await orchestrator.Containers.GetAsync(containerId);
// info.Id, info.Name, info.Image, info.State, ...
// Pull an image
await orchestrator.Images.PullAsync(new PullImageRequest
{
Image = "nginx",
Tag = "latest"
});
// List images
var images = await orchestrator.Images.ListAsync();
// Tag an image
await orchestrator.Images.TagAsync(imageId, "myregistry/nginx", "v2");
// Remove an image
await orchestrator.Images.RemoveAsync(imageId, force: true);
// Create a bridge network
var networkId = await orchestrator.Networks.CreateAsync("my-network", driver: "bridge");
// Connect / disconnect a container
await orchestrator.Networks.ConnectAsync(networkId, containerId);
await orchestrator.Networks.DisconnectAsync(networkId, containerId);
// List and remove
var networks = await orchestrator.Networks.ListAsync();
await orchestrator.Networks.RemoveAsync(networkId);
// Create a volume
var volume = await orchestrator.Volumes.CreateAsync("my-volume", driver: "local");
// List and remove
var volumes = await orchestrator.Volumes.ListAsync();
await orchestrator.Volumes.RemoveAsync("my-volume", force: true);
Install the tracing package:
dotnet add package Bielu.Microservices.Orchestrator.OpenTelemetry
AddOpenTelemetryInstrumentation() wraps every registered manager interface with a decorator that opens an Activity span per operation. Call it after registering a provider:
using Bielu.Microservices.Orchestrator.OpenTelemetry.Extensions;
builder.Services.AddMicroservicesOrchestrator(orchestrator =>
{
orchestrator
.AddDocker()
.AddOpenTelemetryInstrumentation(); // must come after the provider
});
Then register the library's ActivitySource with the OpenTelemetry SDK so spans reach your exporter:
using OpenTelemetry.Trace;
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddOrchestratorInstrumentation() // orchestrator spans
.AddAspNetCoreInstrumentation() // HTTP request spans
.AddConsoleExporter()); // or AddOtlpExporter() for production
Every container, image, network, and volume operation will now emit a span with semantic attributes such as container.id, container.image, network.driver, and volume.name.
Install the health-checks package:
dotnet add package Bielu.Microservices.Orchestrator.HealthChecks
AddContainerRuntimeHealthCheck() adds an IHealthCheck that calls IContainerOrchestrator.IsAvailableAsync():
using Bielu.Microservices.Orchestrator.HealthChecks.Extensions;
builder.Services.AddHealthChecks()
.AddContainerRuntimeHealthCheck(
name: "container-runtime",
failureStatus: HealthStatus.Unhealthy,
tags: ["ready", "runtime"]);
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
// Liveness — always healthy if the process is running
app.MapHealthChecks("/health");
// Readiness — healthy only when the container runtime is reachable
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("ready")
});
The check returns:
| Runtime reachable | Result |
|---|---|
| ✅ Yes | Healthy — "Container runtime 'Docker' is available." |
| ❌ No | Unhealthy — "Container runtime 'Docker' is not reachable." |
| 💥 Exception | Unhealthy — exception details attached |
Because every provider implements the same interfaces, switching runtimes is a one-line change. The rest of your code stays exactly the same:
builder.Services.AddMicroservicesOrchestrator(orchestrator =>
{
// Pick one:
orchestrator.AddDocker();
// orchestrator.AddPodman(o => o.Endpoint = "unix:///run/podman/podman.sock");
// orchestrator.AddKubernetes(o => o.Namespace = "my-namespace");
// orchestrator.AddContainerd(o => o.Endpoint = "http://localhost:1234");
orchestrator.AddOpenTelemetryInstrumentation(); // optional, works with any provider
});
A complete working example lives in . Here is the condensed version:
using Bielu.Microservices.Orchestrator.Abstractions;
using Bielu.Microservices.Orchestrator.Docker.Extensions;
using Bielu.Microservices.Orchestrator.Extensions;
using Bielu.Microservices.Orchestrator.HealthChecks.Extensions;
using Bielu.Microservices.Orchestrator.Models;
using Bielu.Microservices.Orchestrator.OpenTelemetry.Extensions;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using OpenTelemetry.Trace;
var builder = WebApplication.CreateBuilder(args);
// 1. Register orchestrator with Docker + tracing
builder.Services.AddMicroservicesOrchestrator(o => o
.AddDocker()
.AddOpenTelemetryInstrumentation());
// 2. Configure OpenTelemetry exporter
builder.Services.AddOpenTelemetry()
.WithTracing(t => t
.AddOrchestratorInstrumentation()
.AddAspNetCoreInstrumentation()
.AddConsoleExporter());
// 3. Health checks
builder.Services.AddHealthChecks()
.AddContainerRuntimeHealthCheck(
failureStatus: HealthStatus.Unhealthy,
tags: ["ready", "runtime"]);
var app = builder.Build();
// Health endpoints
app.MapHealthChecks("/health");
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("ready")
});
// Container CRUD
app.MapGet("/api/containers", async (IContainerOrchestrator o, bool all = false) =>
Results.Ok(await o.Containers.ListAsync(all)));
app.MapPost("/api/containers", async (CreateContainerRequest req, IContainerOrchestrator o) =>
{
var id = await o.Containers.CreateAsync(req);
return Results.Created($"/api/containers/{id}", new { Id = id });
});
app.MapPost("/api/containers/{id}/start", async (string id, IContainerOrchestrator o) =>
{
await o.Containers.StartAsync(id);
return Results.Ok(new { Message = $"Container {id} started." });
});
app.MapPost("/api/containers/{id}/stop", async (string id, IContainerOrchestrator o, int? timeoutSeconds) =>
{
var timeout = timeoutSeconds.HasValue ? TimeSpan.FromSeconds(timeoutSeconds.Value) : (TimeSpan?)null;
await o.Containers.StopAsync(id, timeout);
return Results.Ok(new { Message = $"Container {id} stopped." });
});
app.MapGet("/api/containers/{id}/logs", async (string id, IContainerOrchestrator o) =>
Results.Ok(new { Logs = await o.Containers.GetLogsAsync(id) }));
app.MapDelete("/api/containers/{id}", async (string id, IContainerOrchestrator o, bool force = false) =>
{
await o.Containers.RemoveAsync(id, force);
return Results.NoContent();
});
// Provider info
app.MapGet("/api/provider", async (IContainerOrchestrator o) =>
Results.Ok(new { o.ProviderName, IsAvailable = await o.IsAvailableAsync() }));
app.Run();
IContainerOrchestrator| Member | Description |
|---|---|
Containers |
Access to IContainerManager |
Images |
Access to IImageManager |
Networks |
Access to INetworkManager |
Volumes |
Access to IVolumeManager |
ProviderName |
Runtime name (e.g., "Docker", "Podman") |
IsAvailableAsync() |
Check whether the runtime is reachable |
IContainerManager| Method | Description |
|---|---|
ListAsync(bool all) |
List containers (running only, or all) |
GetAsync(string id) |
Inspect a single container |
CreateAsync(CreateContainerRequest) |
Create a container (or multiple with Replicas) and return its ID |
StartAsync(string id) |
Start a container |
StopAsync(string id, TimeSpan? timeout) |
Gracefully stop a container |
RemoveAsync(string id, bool force) |
Remove a container |
GetLogsAsync(string id, bool stdout, bool stderr) |
Retrieve container logs |
ScaleAsync(string id, int replicas) |
Scale instances (runtime-dependent; may throw NotSupportedException) |
IImageManager| Method | Description |
|---|---|
ListAsync() |
List images |
GetAsync(string id) |
Inspect a single image |
PullAsync(PullImageRequest) |
Pull an image from a registry |
RemoveAsync(string id, bool force) |
Remove an image |
TagAsync(string id, string repo, string tag) |
Tag an image |
INetworkManager| Method | Description |
|---|---|
ListAsync() |
List networks |
CreateAsync(string name, string driver) |
Create a network |
RemoveAsync(string id) |
Remove a network |
ConnectAsync(string networkId, string containerId) |
Connect a container |
DisconnectAsync(string networkId, string containerId) |
Disconnect a container |
IVolumeManager| Method | Description |
|---|---|
ListAsync() |
List volumes |
CreateAsync(string name, string? driver) |
Create a volume |
RemoveAsync(string name, bool force) |
Remove a volume |
MIT — see for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Bielu.Microservices.Orchestrator.Docker:
| Package | Downloads |
|---|---|
|
Bielu.Microservices.Orchestrator.Podman
Bielu.Microservices.Orchestrator.Podman - Podman runtime provider for the microservices orchestrator |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.639158264724296298 | 67 | 5/31/2026 |
| 0.1.0-beta.639158178278571252 | 55 | 5/31/2026 |
| 0.1.0-beta.639152489398351786 | 66 | 5/24/2026 |
| 0.1.0-beta.639152485284745355 | 60 | 5/24/2026 |
| 0.1.0-beta.639152480320690739 | 62 | 5/24/2026 |
| 0.1.0-beta.639149810075693236 | 65 | 5/21/2026 |
| 0.1.0-beta.639142081923002614 | 154 | 5/12/2026 |
| 0.1.0-beta.639136562829533881 | 244 | 5/6/2026 |
| 0.1.0-beta.639131336052321652 | 130 | 4/30/2026 |
| 0.1.0-beta.639131289574253533 | 52 | 4/30/2026 |
| 0.1.0-beta.639131005739871708 | 71 | 4/29/2026 |
| 0.1.0-beta.639130984875607073 | 62 | 4/29/2026 |
| 0.1.0-beta.639130950452591486 | 61 | 4/29/2026 |
| 0.1.0-beta.639130890098150372 | 64 | 4/29/2026 |
| 0.1.0-beta.639130798350092697 | 63 | 4/29/2026 |
| 0.1.0-beta.639130783477698622 | 58 | 4/29/2026 |
| 0.1.0-beta.639127206532149381 | 107 | 4/25/2026 |
| 0.1.0-beta.639115837896700728 | 180 | 4/12/2026 |
| 0.1.0-beta.639115254657979154 | 68 | 4/11/2026 |