Skip to content
RELKIT
Esc
↑↓navigate↵open⌘Jpreview
On this page

Docker API

Generated public TypeScript reference for @relkit/docker.

Common APIs

For configuration and examples, read bindings, docker, integrations.

For a complete workflow, follow upload product images, cache product prices.

Public imports

  • @relkit/docker — 1 exports
  • @relkit/docker/runtime — 16 exports

All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.

API Kind Import from Example
createDockerClient Value @relkit/docker/runtime Source example
createDockerMaterializer Value @relkit/docker/runtime Source example
docker Value @relkit/docker API example
DockerClient Type @relkit/docker/runtime Source example
DockerClientOptions Type @relkit/docker/runtime Module example
DockerCommandOptions Type @relkit/docker/runtime Module example
DockerCommandRequest Type @relkit/docker/runtime Module example
DockerCommandResult Type @relkit/docker/runtime Module example
DockerCommandRunner Type @relkit/docker/runtime Module example
DockerContainer Type @relkit/docker/runtime Module example
DockerEngineError Value @relkit/docker/runtime Module example
DockerEngineErrorCode Type @relkit/docker/runtime Module example
DockerEngineInfo Type @relkit/docker/runtime Module example
DockerHealthOptions Type @relkit/docker/runtime Module example
dockerMaterializer Value @relkit/docker/runtime Module example
DockerVolume Type @relkit/docker/runtime Module example
randomLoopbackPort Value @relkit/docker/runtime Module example

index.ts

docker

Selects an adapter’s declared local recipe without contacting Docker.

Example

import { docker } from "@relkit/docker";
import { redis } from "@relkit/redis";

const cache = docker(redis());

Signature

declare const docker: <const Adapter extends ProviderAdapter>(
  adapter: Adapter,
) => LocalProviderSource<Adapter>;

Source

Since v0.2.0

docker-client.ts

createDockerClient

Signature

declare const createDockerClient: (options?: DockerClientOptions) => DockerClient;

Source

randomLoopbackPort

Signature

declare const randomLoopbackPort: (containerPort: number) => string;

Source

docker-composite-support.ts

argument

Signature

declare const argument: (value: string) => string;

Source

bindMountArguments

Signature

declare const bindMountArguments: (
  mounts: readonly LocalServiceBindMount[] | undefined,
) => string[];

Source

compositeLabels

Signature

declare const compositeLabels: (values: Readonly<Record<string, string>>) => string[];

Source

compositeSignal

Signature

declare const compositeSignal: (request: LocalServiceStartRequest) => {
  readonly signal?: AbortSignal;
};

Source

environmentArguments

Signature

declare const environmentArguments: (
  values: Readonly<Record<string, string>> | undefined,
) => string[];

Source

healthArgs

Signature

declare const healthArgs: (
  command: readonly string[],
  interval: number,
  timeout: number,
  retries: number,
) => string[];

Source

inspectNetwork

Signature

declare const inspectNetwork: (
  client: DockerClient,
  networkName: string,
  request: LocalServiceStartRequest,
) => Promise<Readonly<Record<string, string>> | undefined>;

Source

mountPath

Signature

declare const mountPath: (value: string) => string;

Source

owned

Signature

declare const owned: (
  actual: Readonly<Record<string, string>>,
  expected: Readonly<Record<string, string>>,
) => boolean;

Source

positive

Signature

declare const positive: (value: number) => number;

Source

resourceName

Signature

declare const resourceName: (value: string) => void;

Source

volumeNames

Signature

declare const volumeNames: (
  serviceName: string,
  requested: Readonly<Record<string, string>> | undefined,
  recipe: NormalizedLocalServiceRecipe,
) => Readonly<Record<string, string>>;

Source

docker-composite-unit.ts

reusedUnit

Signature

declare const reusedUnit: (
  existing: LocalServiceInstance,
  unit: NormalizedLocalServiceUnit,
  serviceName: string,
) => LocalServiceInstance;

Source

startUnit

Signature

declare const startUnit: (
  client: DockerClient,
  request: LocalServiceStartRequest,
  recipe: NormalizedLocalServiceRecipe,
  unit: NormalizedLocalServiceUnit,
  networkName: string,
  volumes: Readonly<Record<string, string>>,
  gatewayAddress?: string,
) => Promise<LocalServiceInstance>;

Source

docker-composite.ts

startComposite

Signature

declare const startComposite: (
  client: DockerClient,
  request: LocalServiceStartRequest,
  gatewayAddress?: string,
) => Promise<LocalServiceInstance>;

Source

docker-health.ts

healthTimeout

Signature

declare const healthTimeout: (id: string) => never;

Source

publishedPortArguments

Signature

declare const publishedPortArguments: (
  containerPort: number,
  gatewayAddress?: string,
  hostPort?: number,
) => Promise<string[]>;

Source

randomLoopbackPort

Signature

declare const randomLoopbackPort: (containerPort: number) => string;

Source

wait

Signature

declare const wait: (milliseconds: number, signal?: AbortSignal) => Promise<void>;

Source

docker-inspect.ts

parseContainers

Signature

declare const parseContainers: (source: string) => readonly DockerContainer[];

Source

parseVolumes

Signature

declare const parseVolumes: (source: string) => readonly DockerVolume[];

Source

docker-materializer-support.ts

argument

Signature

declare const argument: (value: string) => string;

Source

duration

Signature

declare const duration: (value: number) => string;

Source

healthCommand

Signature

declare const healthCommand: (values: readonly string[]) => string;

Source

labelArguments

Signature

declare const labelArguments: (values: Readonly<Record<string, string>>) => string[];

Source

labelKey

Signature

declare const labelKey: (value: string) => string;

Source

labels

Signature

declare const labels: (values: Readonly<Record<string, string>>) => void;

Source

mountPath

Signature

declare const mountPath: (value: string) => string;

Source

name

Signature

declare const name: (value: string) => string;

Source

networkLabelFilters

Signature

declare const networkLabelFilters: (values: Readonly<Record<string, string>>) => string[];

Source

positive

Signature

declare const positive: (value: number) => number;

Source

resourceName

Signature

declare const resourceName: (value: string) => string;

Source

docker-materializer.ts

createDockerMaterializer

Signature

declare const createDockerMaterializer: (
  options?: DockerClientOptions & {
    readonly client?: DockerClient;
    readonly gatewayAddress?: string;
  },
) => LocalServiceMaterializerRuntime;

Source

docker-runner.ts

dockerCommandRunner

Signature

declare const dockerCommandRunner: (executable?: string) => DockerCommandRunner;

Source

docker-types.ts

DockerClient (interface)

Signature

export interface DockerClient {
  readonly discover: (signal?: AbortSignal) => Promise<DockerEngineInfo>;
  readonly command: (
    arguments_: readonly string[],
    operation: string,
    options?: DockerCommandOptions,
  ) => Promise<string>;
  readonly containers: (
    labels?: Readonly<Record<string, string>>,
    signal?: AbortSignal,
  ) => Promise<readonly DockerContainer[]>;
  readonly volumes: (
    labels?: Readonly<Record<string, string>>,
    signal?: AbortSignal,
  ) => Promise<readonly DockerVolume[]>;
  readonly inspectContainer: (id: string, signal?: AbortSignal) => Promise<DockerContainer>;
  readonly waitForHealthy: (id: string, options?: DockerHealthOptions) => Promise<DockerContainer>;
}

Source

DockerClientOptions (interface)

Signature

export interface DockerClientOptions {
  readonly executable?: string;
  readonly run?: DockerCommandRunner;
  readonly maxOutputBytes?: number;
  readonly commandTimeoutMs?: number;
  readonly now?: () => number;
  readonly sleep?: (milliseconds: number, signal?: AbortSignal) => Promise<void>;
}

Source

DockerCommandOptions (interface)

Signature

export interface DockerCommandOptions {
  readonly signal?: AbortSignal;
  readonly timeoutMs?: number;
}

Source

DockerCommandRequest (interface)

Signature

export interface DockerCommandRequest extends DockerCommandOptions {
  readonly maxOutputBytes: number;
}

Source

DockerCommandResult (interface)

Signature

export interface DockerCommandResult {
  readonly exitCode: number;
  readonly stdout: string;
  readonly stderr: string;
}

Source

DockerCommandRunner (type alias)

Signature

type DockerCommandRunner = (
  command: readonly string[],
  options: DockerCommandRequest,
) => Promise<DockerCommandResult>;

Source

DockerContainer (interface)

Signature

export interface DockerContainer {
  readonly id: string;
  readonly name: string;
  readonly labels: Readonly<Record<string, string>>;
  readonly state: string;
  readonly health?: "starting" | "healthy" | "unhealthy";
  readonly ports: Readonly<Record<string, number>>;
}

Source

DockerEngineError (class)

Signature

declare class DockerEngineError { constructor(
    readonly code: DockerEngineErrorCode,
    message: string,
  ) }

Source

DockerEngineErrorCode (type alias)

Signature

type DockerEngineErrorCode =
  | "RELKIT_DOCKER_ARGUMENT_INVALID"
  | "RELKIT_DOCKER_UNAVAILABLE"
  | "RELKIT_DOCKER_COMMAND_FAILED"
  | "RELKIT_DOCKER_COMMAND_TIMEOUT"
  | "RELKIT_DOCKER_OUTPUT_LIMIT"
  | "RELKIT_DOCKER_RESPONSE_INVALID"
  | "RELKIT_DOCKER_HEALTH_FAILED"
  | "RELKIT_DOCKER_HEALTH_TIMEOUT"
  | "RELKIT_DOCKER_CANCELLED";

Source

DockerEngineInfo (interface)

Signature

export interface DockerEngineInfo {
  readonly version: string;
}

Source

DockerHealthOptions (interface)

Signature

export interface DockerHealthOptions {
  readonly timeoutMs?: number;
  readonly pollIntervalMs?: number;
  readonly signal?: AbortSignal;
}

Source

DockerVolume (interface)

Signature

export interface DockerVolume {
  readonly name: string;
  readonly labels: Readonly<Record<string, string>>;
}

Source

docker-validation.ts

cancelled

Signature

declare const cancelled: () => never;

Source

invalidArgument

Signature

declare const invalidArgument: () => never;

Source

invalidResponse

Signature

declare const invalidResponse: () => never;

Source

labelFilters

Signature

declare const labelFilters: (labels: Readonly<Record<string, string>> | undefined) => string[];

Source

optionalSignal

Signature

declare const optionalSignal: (signal: AbortSignal | undefined) => DockerCommandOptions;

Source

positive

Signature

declare const positive: (value: number, name: string) => number;

Source

requiredText

Signature

declare const requiredText: (value: unknown, name: string) => string;

Source

resourceLines

Signature

declare const resourceLines: (value: string) => string[];

Source

responseText

Signature

declare const responseText: (value: unknown) => string;

Source

validateArgument

Signature

declare const validateArgument: (value: string) => void;

Source

validateArguments

Signature

declare const validateArguments: (values: readonly string[]) => void;

Source

validateResourceId

Signature

declare const validateResourceId: (value: string) => void;

Source

index.ts

“./docker-client.js” (namespace export)

Re-exports all named exports from the “./docker-client.js” module.

Signature

export * from "./docker-client.js";

Source

“./docker-materializer.js” (namespace export)

Re-exports all named exports from the “./docker-materializer.js” module.

Signature

export * from "./docker-materializer.js";

Source

“./docker-types.js” (namespace export)

Re-exports all named exports from the “./docker-types.js” module.

Signature

export * from "./docker-types.js";

Source

dockerMaterializer

Signature

declare const dockerMaterializer: Readonly<{
  kind: "local-service-materializer";
  protocolVersion: 1;
  integrationId: "docker";
}>;

Source