Skip to content

Networking

Experimental Containers Reviewed 2026-10-02 purview-dev/containers Star on GitHub 3 azurite containers csharp docker dotnet integration-testing mysql nats nuget postgresql rabbitmq redis sql-server testcontainers testing windows wsl wsl-containers wslc

Experimental. This project is an experiment: the public API, defaults and packaging can change between prereleases, and there is no production support guarantee.

WSLC networking behaviour and how Purview.Containers models it.

Mode (ContainerNetworkingMode)EffectPort mappings
null (default)Docker NetworkMode: "none" — no network, no IP❌ CreateContainer throws 0x80070057
Nonesame as null❌
Bridgedcontainer gets 172.17.0.x on the session bridge; host→container mapped ports work✅
  • Host bind address is IPv4 loopback only (HostIp: 127.0.0.1). IPv6 ::1 does not connect to the mapped port.
  • Clients must use 127.0.0.1, not localhost. localhost resolves to ::1 first on .NET; most clients (Npgsql, StackExchange.Redis) fall back to IPv4, but Microsoft.Data.SqlClient hangs on ::1 without falling back, so the SQL Server module’s connection strings use 127.0.0.1,{port} explicitly.
  • Containers in the same session can reach each other by IP (Bridged) — wget http://<ip>:8080/ works.
  • No name/DNS resolution between containers. wget http://<hostname>:8080/ and http://<container-name>:8080/ fail with “bad address”; /etc/hosts contains only localhost + the container’s own IP <short-id>.
  • There are no managed network objects (no network create/connect in Microsoft.WSL.Containers, unlike the CLI).
  1. Default NetworkingMode = Bridged for containers that bind ports (or, by default, for all containers to be useful). This is baked into ContainerBuilder defaults.
  2. GetMappedPublicPort(containerPort) reads Inspect().Ports["<port>/tcp"][0].HostPort.
  3. GetNetworkIp() reads Inspect().NetworkSettings.Networks.bridge.IPAddress (Bridged only).
  4. TCP/HTTP wait strategies connect to 127.0.0.1:<hostPort> (IPv4 only).
  5. Multi-container environments are deliberately deferred. Because there is no native DNS/alias, a future ContainerEnvironmentBuilder would wire containers together by passing each other’s IPs (from GetNetworkIp()) into configuration/env. The core API must not preclude this (it doesn’t — GetNetworkIp + environment are enough).
  • Do not invent Docker-style Network objects; the underlying semantics are just “bridged with IPs”.
  • Do not claim container-name resolution works; it does not.