docker-pilot
Version:
A powerful, scalable Docker CLI library for managing containerized applications of any size
138 lines • 3.65 kB
TypeScript
/**
* Docker utility functions
* Provides Docker-specific operations and checks
*/
import { ChildProcess } from 'child_process';
import { DockerComposeConfig, ServiceStatus, ProjectStatus, CommandResult } from '../types';
import { Logger } from './Logger';
export interface DockerInfo {
version: string;
serverVersion: string;
isRunning: boolean;
hasCompose: boolean;
composeVersion?: string;
}
export interface ContainerInfo {
id: string;
name: string;
image: string;
state: string;
status: string;
ports: string[];
created: string;
networks: string[];
}
export declare class DockerUtils {
private logger;
constructor(logger?: Logger);
/**
* Check if Docker is installed and running
*/
checkDockerStatus(): Promise<DockerInfo>;
/**
* Execute Docker command
*/
executeDockerCommand(command: string, args?: string[], options?: {
silent?: boolean;
timeout?: number;
cwd?: string;
}): Promise<CommandResult>;
/**
* Execute Docker Compose command
*/
executeComposeCommand(command: string, args?: string[], options?: {
silent?: boolean;
timeout?: number;
cwd?: string;
composeFile?: string;
}): Promise<CommandResult>;
/**
* Generic command execution
*/
private executeCommand;
/**
* Get container information
*/
getContainers(projectName?: string): Promise<ContainerInfo[]>;
/**
* Get service status from Docker Compose
*/
getServiceStatus(_projectName: string, serviceName?: string, options?: {
composeFile?: string;
}): Promise<ServiceStatus[]>;
/**
* Get project status
*/ getProjectStatus(projectName: string): Promise<ProjectStatus>;
/**
* Get project networks
*/
private getProjectNetworks;
/**
* Get project volumes
*/
private getProjectVolumes;
/**
* Normalize container state
*/
private normalizeState;
/**
* Normalize health status
*/
private normalizeHealth;
/**
* Get container logs
*/ getLogs(serviceName: string, options?: {
follow?: boolean;
tail?: number;
since?: string;
until?: string;
projectName?: string;
composeFile?: string;
}): Promise<ChildProcess | CommandResult>;
/**
* Get container statistics
*/
getStats(serviceName?: string): Promise<any[]>;
/**
* Clean Docker system
*/ cleanSystem(options?: {
volumes?: boolean;
images?: boolean;
networks?: boolean;
}): Promise<CommandResult>;
/**
* Pull images for services
*/
pullImages(serviceName?: string): Promise<CommandResult>;
/**
* Build services
*/
buildServices(serviceName?: string, options?: {
noCache?: boolean;
pull?: boolean;
}): Promise<CommandResult>;
/**
* Scale services
*/
scaleService(serviceName: string, replicas: number): Promise<CommandResult>;
/**
* Execute command in service container
*/
execInService(serviceName: string, command: string[], options?: {
interactive?: boolean;
tty?: boolean;
user?: string;
}): Promise<CommandResult | ChildProcess>;
/**
* Get Docker Compose configuration
*/
getComposeConfig(): Promise<DockerComposeConfig | null>;
/**
* Validate Docker Compose file
*/
validateComposeFile(filePath?: string): Promise<{
valid: boolean;
errors: string[];
}>;
}
//# sourceMappingURL=DockerUtils.d.ts.map