TestcontainerEx.Server (testcontainer_ex v0.7.2)

Copy Markdown View Source

GenServer that manages the TestcontainerEx lifecycle.

State holds the connection, session metadata, and tracked resources (containers, networks, compose environments) for cleanup on termination.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns true if the server has a working Docker connection.

Returns the engine currently in use by the given server.

Reconnects the server to a different container engine at runtime.

Stops the GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

connected?(name \\ __MODULE__)

Returns true if the server has a working Docker connection.

get_engine(name \\ __MODULE__)

Returns the engine currently in use by the given server.

Returns an engine atom (:docker, :podman, :colima, :minikube, :apple_container) or :auto if no explicit engine was selected.

reconnect(options, name \\ __MODULE__)

Reconnects the server to a different container engine at runtime.

This stops all tracked containers, tears down the existing connection, and re-initializes with the specified engine.

Options

  • :engine — the engine to switch to (e.g., :docker, :podman, :colima, :minikube, :apple_container, or :auto for auto-detection)

Examples

# Switch to Podman
TestcontainerEx.reconnect(engine: :podman)

# Switch back to auto-detection
TestcontainerEx.reconnect(engine: :auto)

start(options \\ [])

start_link(options \\ [])

stop(name \\ __MODULE__)

Stops the GenServer.