TestcontainerEx.Network (testcontainer_ex v0.5.1)

Copy Markdown View Source

Docker network operations.

Summary

Functions

Inspects the default bridge network and returns its gateway IP. Used for Docker-outside-of-Docker (DooD) detection.

Creates a Docker network. Returns {:ok, id} or {:ok, :already_exists}. Retries on transient errors.

Checks if a network exists.

Removes a Docker network.

Functions

bridge_gateway(conn)

@spec bridge_gateway(Req.Request.t()) :: {:ok, String.t()} | {:error, term()}

Inspects the default bridge network and returns its gateway IP. Used for Docker-outside-of-Docker (DooD) detection.

create(name, conn)

@spec create(String.t(), Req.Request.t()) ::
  {:ok, String.t()} | {:ok, :already_exists} | {:error, term()}

Creates a Docker network. Returns {:ok, id} or {:ok, :already_exists}. Retries on transient errors.

exists?(name, conn)

@spec exists?(String.t(), Req.Request.t()) :: boolean()

Checks if a network exists.

remove(name, conn)

@spec remove(String.t(), Req.Request.t()) :: :ok | {:error, term()}

Removes a Docker network.