Class DockerDetector

Constructors

Methods

  • Check if Docker is installed and the daemon is running. Runs docker info with a 5-second timeout.

    Returns boolean

    True if Docker is available and responsive.

  • Check the state of a named Docker container.

    Parameters

    • name: string

      Container name to inspect.

    Returns "running" | "stopped" | "not_found"

    'running' if active, 'stopped' if exists but not running, 'not_found' if the container doesn't exist.

  • Start a stopped container by name.

    Parameters

    • name: string

      Container name to start.

    Returns void

    Throws

    If the container cannot be started.

  • Pull a Docker image and run a new container.

    Parameters

    • opts: {
          name: string;
          image: string;
          ports: string[];
          volumes: string[];
          env?: Record<string, string>;
      }
      • name: string

        Container name.

      • image: string

        Docker image (e.g. 'qdrant/qdrant:latest').

      • ports: string[]

        Port mappings (e.g. ['6333:6333', '6334:6334']).

      • volumes: string[]

        Volume mounts (e.g. ['data-vol:/data']).

      • Optional env?: Record<string, string>

        Environment variables (e.g. { POSTGRES_PASSWORD: 'pw' }).

    Returns void

  • Poll a health check URL until it returns 200 or timeout is reached. Checks every 500ms.

    Parameters

    Returns Promise<boolean>

    True if the endpoint became healthy within the timeout.

    Default

    15000
    
  • Get the mapped host port for a container's internal port. Useful when the host port was dynamically assigned.

    Parameters

    • name: string

      Container name.

    • internalPort: number

      The container-internal port to look up.

    Returns null | number

    The host port number, or null if not found.