<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7" -->

---
title: Run temporary containers in .NET tests with...
description: Meziantou.Framework.TemporaryContainers is a .NET library for spinning up disposable containers in integration tests, offering the same API regardless of the...
canonical: https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers | daily.dev
og:description: Meziantou.Framework.TemporaryContainers is a .NET library for spinning up disposable containers in integration tests, offering the same API regardless of the...
og:url: https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7
og:image: https://api.daily.dev/og/posts/Yc0rhJOs7.png
og:image:alt: Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers

**[Meziantou](https://daily.dev/sources/meziantou)** · 7 min read · 1 upvotes · 0 comments

## Summary

Meziantou.Framework.TemporaryContainers is a .NET library for spinning up disposable containers in integration tests, offering the same API regardless of the underlying runtime. Unlike libraries tied to the Docker Engine API, it also drives runtimes without a Docker-compatible socket, such as Apple's container CLI on macOS and wslc on Windows. It auto-detects the available runtime (DockerApi, Docker, Podman, AppleContainer, or Wslc), normalizes differences like port mapping and restart behavior, supports container reuse across runs, includes prebuilt helpers for Redis, PostgreSQL, MongoDB, and SQL Server, and can forward container logs to ILogger or xUnit test output.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.meziantou.net/run-temporary-containers-in-dotnet-tests-with-meziantou-framework-temporaryconta.htm>

## Questions this post answers

### How can I run integration tests against a real Redis instance in .NET without depending on Docker specifically?

Meziantou.Framework.TemporaryContainers lets you start a disposable Redis container in a .NET test using ContainerDefinition and ContainerRuntime.Auto, which detects whatever runtime is available: Docker Engine API, Docker CLI, Podman, Apple's container on macOS, or wslc on Windows. The same test code works unchanged across all of them, with GetMappedPort returning the correct host port on every runtime.

_daily.dev surfaces practical writeups like this for developers weighing container-based test strategies._

### What are the limitations of Apple's container CLI compared to Docker when used for testing?

Apple's container has no volume driver, its mount descriptors cannot contain a comma, and as of version 1.1.0 it hangs when a container mounts a volume previously used by a deleted container, so volumes should stay attached to a single container. It also cannot assign a random host port and throws NotSupportedException on PauseAsync, unlike Docker.

_Teams evaluating Apple container for CI or local testing can track gotchas like these through daily.dev._

### How do I reuse a test container across multiple test runs instead of recreating it each time?

Setting definition.ReuseId to a fixed string on a ContainerDefinition in Meziantou.Framework.TemporaryContainers lets an existing matching container be reused instead of recreated, and reused containers are not removed when disposed. This speeds up local test iteration when full container startup time becomes a bottleneck.

_daily.dev helps developers optimizing slow integration test suites find techniques like container reuse._

## Similar posts on daily.dev

- [Windows 11 can now run Linux containers without Docker, and I tested if WSL Containers could actually replace it](https://daily.dev/posts/windows-11-can-now-run-linux-containers-without-docker-and-i-tested-if-wsl-containers-could-actuall-9aom9secf) · XDA Developers · 0 upvotes · 0 comments
- [Containerize Your .NET Applications Without a Dockerfile](https://daily.dev/posts/containerize-your-net-applications-without-a-dockerfile-1qk5lm6ob) · Milan Jovanović · 19 upvotes · 0 comments
- [WSL container is now available for public preview](https://daily.dev/posts/wsl-container-is-now-available-for-public-preview-qszgs39xw) · Windows Command Line · 110 upvotes · 8 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#docker](https://daily.dev/tags/docker), [#.net](https://daily.dev/tags/.net), [#containers](https://daily.dev/tags/containers)

[View this post on daily.dev](https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers","url":"https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7"},"datePublished":"2026-09-07T12:12:06.503Z","dateModified":"2026-09-13T20:49:22.282Z","description":"Meziantou.Framework.TemporaryContainers is a .NET library for spinning up disposable containers in integration tests, offering the same API regardless of the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a1691098d2e08ce8d92da917d785b212?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a1691098d2e08ce8d92da917d785b212?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Meziantou","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Meziantou","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1bdfdd5349654b08ab6fa3f1ac38192c","url":"https://daily.dev/sources/meziantou"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,docker,.net,containers","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Meziantou","item":"https://daily.dev/sources/meziantou"},{"@type":"ListItem","position":3,"name":"Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/run-temporary-containers-in-net-tests-with-meziantou-framework-temporarycontainers-yc0rhjos7#faq","mainEntity":[{"@type":"Question","name":"How can I run integration tests against a real Redis instance in .NET without depending on Docker specifically?","acceptedAnswer":{"@type":"Answer","text":"Meziantou.Framework.TemporaryContainers lets you start a disposable Redis container in a .NET test using ContainerDefinition and ContainerRuntime.Auto, which detects whatever runtime is available: Docker Engine API, Docker CLI, Podman, Apple's container on macOS, or wslc on Windows. The same test code works unchanged across all of them, with GetMappedPort returning the correct host port on every runtime. daily.dev surfaces practical writeups like this for developers weighing container-based test strategies."}},{"@type":"Question","name":"What are the limitations of Apple's container CLI compared to Docker when used for testing?","acceptedAnswer":{"@type":"Answer","text":"Apple's container has no volume driver, its mount descriptors cannot contain a comma, and as of version 1.1.0 it hangs when a container mounts a volume previously used by a deleted container, so volumes should stay attached to a single container. It also cannot assign a random host port and throws NotSupportedException on PauseAsync, unlike Docker. Teams evaluating Apple container for CI or local testing can track gotchas like these through daily.dev."}},{"@type":"Question","name":"How do I reuse a test container across multiple test runs instead of recreating it each time?","acceptedAnswer":{"@type":"Answer","text":"Setting definition.ReuseId to a fixed string on a ContainerDefinition in Meziantou.Framework.TemporaryContainers lets an existing matching container be reused instead of recreated, and reused containers are not removed when disposed. This speeds up local test iteration when full container startup time becomes a bottleneck. daily.dev helps developers optimizing slow integration test suites find techniques like container reuse."}}]}
```

