@apiclient.xyz/docker
Version:
Provides easy communication with Docker remote API from Node.js, with TypeScript support.
89 lines (88 loc) • 2.72 kB
TypeScript
import * as plugins from './plugins.js';
import { DockerContainer } from './classes.container.js';
import { DockerNetwork } from './classes.network.js';
import { DockerService } from './classes.service.js';
import { DockerImageStore } from './classes.imagestore.js';
import { DockerImage } from './classes.image.js';
export interface IAuthData {
serveraddress: string;
username: string;
password: string;
}
export interface IDockerHostConstructorOptions {
dockerSockPath?: string;
imageStoreDir?: string;
}
export declare class DockerHost {
options: IDockerHostConstructorOptions;
/**
* the path where the docker sock can be found
*/
socketPath: string;
private registryToken;
imageStore: DockerImageStore;
smartBucket: plugins.smartbucket.SmartBucket;
/**
* the constructor to instantiate a new docker sock instance
* @param pathArg
*/
constructor(optionsArg: IDockerHostConstructorOptions);
start(): Promise<void>;
stop(): Promise<void>;
/**
* authenticate against a registry
* @param userArg
* @param passArg
*/
auth(authData: IAuthData): Promise<void>;
/**
* gets the token from the .docker/config.json file for GitLab registry
*/
getAuthTokenFromDockerConfig(registryUrlArg: string): Promise<void>;
/**
* gets all networks
*/
getNetworks(): Promise<DockerNetwork[]>;
/**
* create a network
*/
createNetwork(optionsArg: Parameters<typeof DockerNetwork.createNetwork>[1]): Promise<DockerNetwork>;
/**
* get a network by name
*/
getNetworkByName(networkNameArg: string): Promise<DockerNetwork>;
/**
* gets all containers
*/
getContainers(): Promise<DockerContainer[]>;
/**
* gets all services
*/
getServices(): Promise<DockerService[]>;
/**
* get all images
*/
getImages(): Promise<DockerImage[]>;
/**
* get an image by name
*/
getImageByName(imageNameArg: string): Promise<DockerImage>;
/**
*
*/
getEventObservable(): Promise<plugins.rxjs.Observable<any>>;
/**
* activates docker swarm
*/
activateSwarm(addvertisementIpArg?: string): Promise<void>;
/**
* fire a request
*/
request(methodArg: string, routeArg: string, dataArg?: {}): Promise<plugins.smartrequest.IExtendedIncomingMessage>;
requestStreaming(methodArg: string, routeArg: string, readStream?: plugins.smartstream.stream.Readable): Promise<plugins.smartrequest.IExtendedIncomingMessage>;
/**
* add s3 storage
* @param optionsArg
*/
addS3Storage(optionsArg: plugins.tsclass.storage.IS3Descriptor): Promise<void>;
}