Rig.TUnit.Docker 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Docker.
dotnet add package Rig.TUnit.Docker --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Docker -Version 0.1.0-beta.2
                    
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="Rig.TUnit.Docker" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Docker" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Docker" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rig.TUnit.Docker --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Docker, 0.1.0-beta.2"
                    
#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.
#:package Rig.TUnit.Docker@0.1.0-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rig.TUnit.Docker&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Docker&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Docker

Generic Testcontainers-backed ContainerFixture for 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.ContainerFixture
  • Rig.TUnit.Docker.Options.DockerFixtureOptions
  • Rig.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.host resolution handles CI nesting), but port mapping differs — use fx.Container.GetMappedPublicPort(port) for reliability.
  • Ductus.FluentDocker is 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.

License

MIT. See LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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