TestcontainerEx.Network (testcontainer_ex v0.1.0)

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}.

Checks if a network exists.

Removes a Docker network.

Functions

bridge_gateway(conn)

@spec bridge_gateway(Tesla.Env.client()) :: {: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(), Tesla.Env.client()) ::
  {:ok, String.t()} | {:ok, :already_exists} | {:error, term()}

Creates a Docker network. Returns {:ok, id} or {:ok, :already_exists}.

exists?(name, conn)

@spec exists?(String.t(), Tesla.Env.client()) :: boolean()

Checks if a network exists.

remove(name, conn)

@spec remove(String.t(), Tesla.Env.client()) :: :ok | {:error, term()}

Removes a Docker network.