Rig.TUnit.Docker
0.1.0-beta.2
dotnet add package Rig.TUnit.Docker --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Docker -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Docker" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Docker" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Docker" />
paket add Rig.TUnit.Docker --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Docker, 0.1.0-beta.2"
#:package Rig.TUnit.Docker@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Docker&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Docker&version=0.1.0-beta.2&prerelease
Rig.TUnit.Docker
Generic Testcontainers-backed
ContainerFixturefor bespoke / third-party / exploratory container testing. Escape hatch when no provider-specific fixture fits.
What this package is
A general-purpose container fixture for situations where none of the
provider-specific packages (SqlServer, Redis, Kafka, …) apply. Spins
an arbitrary image through Testcontainers, exposes the raw
IContainer for bespoke control, and wires the same
IsolationKey-based naming convention every other fixture uses.
Use when you are prototyping against a third-party service without a Rig.TUnit package, writing a custom test-harness container, or exploring a new backend before graduating to its own provider package.
When to use it
- Testing a new third-party service that has no Rig.TUnit package yet.
- Custom test-harness containers (your own Docker image).
- Exploratory testing before a full provider package lands.
- Not for: production-shape testing of services with a dedicated Rig.TUnit package — use that instead.
Prerequisites
- .NET 10 SDK
- Docker Desktop / Colima
Testcontainers(transitive)
Quick start
using Rig.TUnit.Docker.Fixtures;
await using var fx = new ContainerFixture(
image: "alpine:3",
env: new Dictionary<string, string> { ["FOO"] = "bar" },
exposedPorts: new[] { 8080 });
await fx.InitializeAsync();
Options
| Property | Type | Default | Description |
|---|---|---|---|
DefaultImage |
string |
"alpine:3" |
Fallback image |
IsolatePerTestNetwork |
bool |
true |
Each fixture gets its own Docker network |
ReuseImageCache |
bool |
true |
Cache pulled images across fixtures |
DefaultStartupTimeoutSeconds |
int |
300 |
Readiness deadline |
Fixture + helper APIs
Rig.TUnit.Docker.Fixtures.ContainerFixtureRig.TUnit.Docker.Options.DockerFixtureOptionsRig.TUnit.Docker.Builder.DockerRigBuilder
Per-test isolation
Each ContainerFixture owns its container and network. Container names
include the IsolationKey suffix so parallel tests do not collide.
Parallelism + performance
- First-run pull: dominated by image size (alpine:3 ~8 MB).
- Warm startup: seconds (image-specific).
- Parallelism: bounded by Docker daemon capacity.
Troubleshooting
- Container exits immediately — check logs via
fx.Container.GetLogsAsync(); the fixture surfaces them for diagnosis. - Port conflicts — Testcontainers allocates ephemeral host ports; fixed-port usage breaks parallelism.
See docs/troubleshooting.md#docker.
Provider quirks + edge cases
- Docker-in-Docker is supported (Testcontainers's
tc.hostresolution handles CI nesting), but port mapping differs — usefx.Container.GetMappedPublicPort(port)for reliability. Ductus.FluentDockeris kept as a fallback escape hatch if the native Testcontainers compose backend regresses; activation criteria are documented per-incident.
Benchmarks
See DockerBenchmarks.cs;
baseline in benchmarks/baseline-005.json.
Related docs
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Bogus (>= 35.6.1)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Rig.TUnit.Core (>= 0.1.0-beta.2)
- Testcontainers (>= 4.11.0)
- TUnit.Core (>= 1.34.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rig.TUnit.Docker:
| Package | Downloads |
|---|---|
|
Rig.TUnit.All
Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 49 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 53 | 4/26/2026 |