import * as plugins from './plugins.js'; import type * as interfaces from './interfaces/index.js'; import { DockerContainer } from './classes.container.js'; import { DockerConfig } from './classes.config.js'; import { DockerNetwork } from './classes.network.js'; import { DockerService } from './classes.service.js'; import { DockerSecret } from './classes.secret.js'; import { type IDockerImageArchiveReceipt, type IDockerImageStoreOperationOptions } from './classes.imagestore.js'; import { DockerImage } from './classes.image.js'; import { DockerVolume } from './classes.volume.js'; export interface IDockerInfo { /** Daemon security feature strings, including `name=rootless` when enabled. */ SecurityOptions: string[]; } export interface IDockerHostConstructorOptions { socketPath?: string; imageStoreDir?: string; /** Set false to prevent host lifecycle methods from creating image-store files. */ enableImageStore?: boolean; } export interface IHijackedStreamingResponse { stream: plugins.stream.Duplex; close: () => Promise; statusCode: number; headers: plugins.http.IncomingHttpHeaders; } export interface IHijackedStreamingRequestOptions { /** Handshake deadline in milliseconds. Defaults to 30000; pass 0 to disable. */ timeoutMs?: number; /** Cancels the pending handshake and closes its underlying request or socket. */ signal?: AbortSignal; } export interface IDockerRequestOptions { /** * Socket idle timeout in milliseconds. Defaults to 30000. * Pass 0 for Docker operations such as image pulls that may remain silent * while the daemon downloads or extracts a large layer. */ timeoutMs?: number; /** Registry credentials scoped exclusively to this request. */ registryAuth?: interfaces.TDockerRegistryAuth; /** Cancels the request and any response body consumption. */ signal?: AbortSignal; } export interface IDockerStreamingRequestOptions { /** * Socket idle timeout in milliseconds. Defaults to 30000. * Pass 0 for long-lived streams such as events or followed logs. */ timeoutMs?: number; /** Cancels a pending stream open. */ signal?: AbortSignal; } export interface IDockerStreamingErrorResponse { statusCode: number; body: string; headers: Record; } export declare class DockerHost { options: IDockerHostConstructorOptions; /** * the path where the docker sock can be found */ socketPath: string; private imageStore?; smartBucket?: plugins.smartbucket.SmartBucket; private readonly storageLifecycleStack; private stopRequested; /** * the constructor to instantiate a new docker sock instance * @param pathArg */ constructor(optionsArg: IDockerHostConstructorOptions); start(): Promise; stop(): Promise; /** * Ping the Docker daemon to check if it's running and accessible * @returns Promise that resolves if Docker is available, rejects otherwise * @throws Error if Docker ping fails */ ping(): Promise; /** Read daemon security features afresh before a rootful container request. */ info(): Promise; /** * Get Docker daemon version information * @returns Version info including Docker version, API version, OS, architecture, etc. */ getVersion(): Promise<{ Version: string; ApiVersion: string; MinAPIVersion?: string; GitCommit: string; GoVersion: string; Os: string; Arch: string; KernelVersion: string; BuildTime?: string; }>; /** * Lists all networks */ listNetworks(optionsArg?: interfaces.INetworkListOptions): Promise; /** Gets a network through direct immutable-ID inspection. */ getNetworkById(networkIdArg: string): Promise; /** * Gets a network by name */ getNetworkByName(networkNameArg: string): Promise; /** * Creates a network */ createNetwork(descriptor: interfaces.INetworkCreationDescriptor): Promise; listVolumes(optionsArg?: interfaces.IVolumeListOptions): Promise; getVolumeByName(volumeNameArg: string): Promise; createVolume(descriptorArg: interfaces.IVolumeCreationDescriptor): Promise; /** * Lists all containers */ listContainers(optionsArg?: interfaces.IContainerListOptions): Promise; /** * Gets a container by ID * Returns undefined if container does not exist */ getContainerById(containerId: string, optionsArg?: interfaces.IContainerReadOptions): Promise; /** * Creates a container */ createContainer(descriptor: interfaces.IContainerCreationDescriptor): Promise; /** * Lists all services */ listServices(): Promise; /** * Gets a service by name */ getServiceByName(serviceName: string): Promise; /** * Gets a service by its exact Docker service ID. * Returns undefined only when Docker reports that exact ID as absent. */ getServiceById(serviceId: string): Promise; /** * Creates a service */ createService(descriptor: interfaces.IServiceCreationDescriptor): Promise; /** * Lists all images */ listImages(optionsArg?: interfaces.IImageListOptions): Promise; /** * Gets an image by a complete local tag or digest reference. */ getImageByReference(referenceArg: string): Promise; /** * Gets an image through its immutable local ID. */ getImageById(idArg: string): Promise; /** Pulls and verifies an exact registry image. */ pullImage(descriptorArg: interfaces.IImagePullDescriptor): Promise; /** Pulls an explicitly tagged mutable application image as an inspected DockerImage. */ pullMutableImage(descriptorArg: interfaces.IImageMutablePullDescriptor): Promise; /** * Creates an image from a tar stream */ createImageFromTarStream(tarStream: plugins.smartstream.stream.Readable, descriptor: interfaces.IImageCreationDescriptor): Promise; /** * Prune unused images * @param options Optional filters (dangling, until, label) * @returns Object with deleted images and space reclaimed */ pruneImages(options?: { dangling?: boolean; filters?: Record; }): Promise<{ ImagesDeleted: Array<{ Untagged?: string; Deleted?: string; }>; SpaceReclaimed: number; }>; /** * Builds an image from a Dockerfile */ buildImage(imageTag: string): Promise; /** * Lists all secrets */ listSecrets(): Promise; /** * Gets a secret by name */ getSecretByName(secretName: string): Promise; /** * Gets a secret by ID */ getSecretById(secretId: string): Promise; /** * Creates a secret */ createSecret(descriptor: interfaces.ISecretCreationDescriptor): Promise; /** * Lists all configs */ listConfigs(): Promise; /** * Gets a config by ID */ getConfigById(configId: string): Promise; /** * Gets a config by name */ getConfigByName(configName: string): Promise; /** * Creates a config */ createConfig(descriptor: interfaces.IConfigCreationDescriptor): Promise; /** * Atomically stores or replaces the conventional image archive in SmartBucket. */ storeImage(imageName: string, tarStream: plugins.smartstream.stream.Readable): Promise; /** Creates a unique archive with an exact receipt for the repacked stored bytes. */ storeImageArchive(imageName: string, tarStream: plugins.stream.Readable, options?: IDockerImageStoreOperationOptions): Promise; /** * Retrieves an image archive from SmartBucket; the caller owns the returned stream. */ retrieveImage(imageName: string): Promise; /** * Open one supervised event connection. Resolves only after Docker sends HTTP 200 headers * and event listeners are installed. There is no automatic reconnect: any loss is reported * once, so a runtime owner can stop the workload before establishing a new monitor. */ openEventMonitor(optionsArg: interfaces.IDockerEventMonitorOptions): Promise; private openDockerEventStream; /** * Streams docker engine events as parsed objects. * * Events arrive newline-delimited; lines are buffered across chunks so * bursts (multiple events per chunk) and frames split across chunks parse * correctly. The observable completes when the daemon closes the stream — * unless `reconnect` keeps it alive. * * @param optionsArg.filters server-side event filters, e.g. * `{ type: ['container'], event: ['start', 'die'] }` — unwanted events * are never delivered or parsed. * @param optionsArg.reconnect re-establish the stream with backoff * (1s..30s) when it ends or errors, passing `since` so events from the * gap are replayed. Duplicates around the reconnect boundary are * possible; consumers should be idempotent. The stream then only ends * on unsubscribe. */ getEventObservable(optionsArg?: interfaces.IDockerEventObservableOptions): Promise>; /** * activates docker swarm */ activateSwarm(addvertisementIpArg?: string): Promise; /** * fire a request */ request(methodArg: string, routeArg: string, dataArg?: {}, optionsArg?: IDockerRequestOptions): Promise<{ statusCode: any; body: any; headers: any; }>; requestStreaming(methodArg: string, routeArg: string, readStream?: plugins.smartstream.stream.Readable, jsonData?: Record, optionsArg?: IDockerStreamingRequestOptions): Promise; requestHijackedStreaming(methodArg: string, routeArg: string, jsonData?: Record, optionsArg?: IHijackedStreamingRequestOptions): Promise; private createHijackAbortError; private requestHijackedStreamingOverRawSocket; private requestHijackedStreamingOverDenoUnixSocket; private getNodeRequestOptions; private createDuplexForHijackedResponse; private createDuplexForRawSocket; private createDuplexForDenoConn; private parseRawHttpResponseHeaders; private collectErrorResponse; /** * add s3 storage * @param optionsArg */ addS3Storage(optionsArg: plugins.tsclass.storage.IS3Descriptor): Promise; private getEnabledImageStore; private encodeRegistryAuth; }