RemoteDockers v1.4.0 RemoteDockers.ContainerConfig View Source

Link to this section Summary

Functions

Add a DNS option to the container configuration.

Add an environment variable to the specified container configuration.

Add an extra Host to the container configuration.

Add a volume mount point description to the container host configuration.

Add a volume mount point binding (i.e. mount type is bind) to the container configuration.

Build a container configuration with a specified image_name.

Add parameter to the HostConfig element.

Link to this section Functions

Link to this function

add_dns_option(container_config, dns_option) View Source
add_dns_option(RemoteDockers.ContainerConfig, bitstring()) ::
  RemoteDockers.ContainerConfig

Add a DNS option to the container configuration.

See add_dns_option/2

Example:

  iex> ContainerConfig.new("image_name")
  ...> |> ContainerConfig.add_dns_option("dns option")
  %ContainerConfig{
    :Image => "image_name",
    :Env => [],
    :HostConfig => %{
      :DnsOptions => ["dns option"],
    }
  }
Link to this function

add_env(container_config, key, value) View Source
add_env(RemoteDockers.ContainerConfig, bitstring(), bitstring()) ::
  RemoteDockers.ContainerConfig

Add an environment variable to the specified container configuration.

Example:

  iex> ContainerConfig.new("hello-world")
  ...> |> ContainerConfig.add_env("TOTO", "/path/to/toto")
  %ContainerConfig{
    :Image => "hello-world",
    :Env => ["TOTO=/path/to/toto"],
    :HostConfig => %{},
  }
Link to this function

add_extra_host(container_config, hostname, ip) View Source
add_extra_host(RemoteDockers.ContainerConfig, bitstring(), bitstring()) ::
  RemoteDockers.ContainerConfig

Add an extra Host to the container configuration.

See add_extra_host/3

Example:

  iex> ContainerConfig.new("image_name")
  ...> |> ContainerConfig.add_extra_host("my_host", "192.168.10.10")
  %ContainerConfig{
    :Image => "image_name",
    :Env => [],
    :HostConfig => %{
      :ExtraHosts => ["my_host:192.168.10.10"],
    }
  }
Link to this function

add_mount_point(container_config, mount_point) View Source
add_mount_point(RemoteDockers.ContainerConfig, RemoteDockers.MountPoint) ::
  RemoteDockers.ContainerConfig

Add a volume mount point description to the container host configuration.

Example:

  mount_point = %{
    "Source": "/path/to/host/mount/point",
    "Target": "/path/to/container/directory",
    "Type": "bind"
  }
  ContainerConfig.new("MyImage")
  |> ContainerConfig.add(mount_point)
Link to this function

add_mount_point(container_config, source, target, type \\ "bind") View Source
add_mount_point(
  RemoteDockers.ContainerConfig,
  bitstring(),
  bitstring(),
  bitstring()
) :: RemoteDockers.ContainerConfig

Add a volume mount point binding (i.e. mount type is bind) to the container configuration.

source and target values are respectively mapped to the "Source" and "Target" mount point description fields.

See add_mount_point/2

Example:

  iex> ContainerConfig.new("image_name")
  ...> |> ContainerConfig.add_mount_point("/path/to/a/host/mount/point", "/path/to/a/container/directory")
  ...> |> ContainerConfig.add_mount_point("/path/to/another/host/mount/point", "/path/to/another/container/directory")
  %ContainerConfig{
    :Image => "image_name",
    :Env => [],
    :HostConfig => %{
      :Mounts => [
        %MountPoint{
          :Source => "/path/to/a/host/mount/point",
          :Target => "/path/to/a/container/directory",
          :Type => "bind"
        },
        %MountPoint{
          :Source => "/path/to/another/host/mount/point",
          :Target => "/path/to/another/container/directory",
          :Type => "bind"
        }
      ]
    }
  }

Build a container configuration with a specified image_name.

Example:

  iex> ContainerConfig.new("hello-world")
  %ContainerConfig{
    :Image => "hello-world",
    :Env => [],
    :HostConfig => %{}
  }
Link to this function

update_host_config(container_config, key, value) View Source
update_host_config(RemoteDockers.ContainerConfig, bitstring(), any()) ::
  RemoteDockers.ContainerConfig

Add parameter to the HostConfig element.

See update_host_config/3

Example:

  iex> ContainerConfig.new("image_name")
  ...> |> ContainerConfig.update_host_config(:my_custom_key, :my_custom_value)
  %ContainerConfig{
    :Image => "image_name",
    :Env => [],
    :HostConfig => %{
      :my_custom_key => :my_custom_value,
    }
  }