Tank.OCI (Tank v0.1.0)

Copy Markdown View Source

Interprets a pulled OCI image config against a Tank.Container spec to derive the workload's run parameters, per the OCI rules:

  • argv — the spec's command overrides the image Entrypoint, and args overrides Cmd. As in Docker, setting command resets Cmd: with command given, argv is command ++ args (the image Cmd is dropped); otherwise argv is Entrypoint ++ (args || Cmd).
  • env = the image Env, with the spec's env merged over it.
  • cwd = working_dir || image WorkingDir || "/".

The image config is the raw parsed OCI config map (config["config"] holds the runtime fields), as returned by Tank.Image.pull/2.

Summary

Functions

Derive %{argv:, env:, cwd:} for container from image_config. Returns {:error, :no_command} if neither the spec nor the image provides a command.

Types

run_params()

@type run_params() :: %{argv: [String.t()], env: [String.t()], cwd: String.t()}

Functions

run_params(container, image_config)

@spec run_params(Tank.Container.t(), map()) ::
  {:ok, run_params()} | {:error, :no_command}

Derive %{argv:, env:, cwd:} for container from image_config. Returns {:error, :no_command} if neither the spec nor the image provides a command.