dockerbridge

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dockerbridge creates Testcontainers bridges whose allocated subnet can also accept endpoints restored to their original IP on older Engines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New first lets Docker choose an unused IPv4 subnet from its configured address pools, then recreates an empty bridge with that subnet explicitly configured. This permits reconnecting a Ceph endpoint at its advertised IP on Engines which require an explicit subnet for static endpoint addresses. Both temporary and final networks retain Testcontainers labels and Ryuk lifecycle handling.

Allocations of one process run one at a time. Only Docker's pool-overlap error, from a bridge another process created meanwhile, is retried, at most four allocations and within ctx. Failure cleanup uses its own bounded context. A non-nil network returned with an error remains owned by the caller and must be removed; inspection, removal or client-close failures never discard that ownership.

func NewFamily added in v0.2.0

func NewFamily(ctx context.Context, family Family) (*testcontainers.DockerNetwork, error)

NewFamily is New for the given family. A DualStack bridge keeps both allocated subnets explicitly, so endpoints can be restored at both addresses. An Engine without an IPv6 address pool fails the allocation.

func RestoreEndpoint added in v0.4.0

RestoreEndpoint copies the advertised addresses and requested aliases for reconnection.

Types

type Family added in v0.2.0

type Family int

Family selects the subnets of a bridge.

const (
	// IPv4Only creates a bridge with one IPv4 subnet.
	IPv4Only Family = iota
	// DualStack creates a bridge with one IPv4 and one IPv6 subnet. Docker
	// allocates the IPv6 subnet from its default unique local pool.
	DualStack
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL