@lakutata/docker 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +309 -0
- package/THIRD_PARTY_NOTICES.md +299 -0
- package/dist/cjs/client/BuildContext.d.ts +22 -0
- package/dist/cjs/client/BuildContext.js +76 -0
- package/dist/cjs/client/BuildKitProgress.d.ts +81 -0
- package/dist/cjs/client/BuildKitProgress.js +195 -0
- package/dist/cjs/client/DockerClient.d.ts +196 -0
- package/dist/cjs/client/DockerClient.js +312 -0
- package/dist/cjs/client/DockerConnection.d.ts +154 -0
- package/dist/cjs/client/DockerConnection.js +397 -0
- package/dist/cjs/client/DockerIgnore.d.ts +44 -0
- package/dist/cjs/client/DockerIgnore.js +186 -0
- package/dist/cjs/client/DockerRequestError.d.ts +17 -0
- package/dist/cjs/client/DockerRequestError.js +24 -0
- package/dist/cjs/client/DockerStreams.d.ts +35 -0
- package/dist/cjs/client/DockerStreams.js +117 -0
- package/dist/cjs/client/types/ContainerCreateResponse.d.ts +7 -0
- package/dist/cjs/client/types/ContainerCreateResponse.js +2 -0
- package/dist/cjs/client/types/ContainerStopQuery.d.ts +13 -0
- package/dist/cjs/client/types/ContainerStopQuery.js +2 -0
- package/dist/cjs/client/types/DeviceMapping.d.ts +8 -0
- package/dist/cjs/client/types/DeviceMapping.js +2 -0
- package/dist/cjs/client/types/IdResponse.d.ts +6 -0
- package/dist/cjs/client/types/IdResponse.js +2 -0
- package/dist/cjs/client/types/NetworkCreateResponse.d.ts +7 -0
- package/dist/cjs/client/types/NetworkCreateResponse.js +2 -0
- package/dist/cjs/client/types/PortBinding.d.ts +10 -0
- package/dist/cjs/client/types/PortBinding.js +2 -0
- package/dist/cjs/docker/ConnectionOptionsBuilder.d.ts +128 -0
- package/dist/cjs/docker/ConnectionOptionsBuilder.js +150 -0
- package/dist/cjs/docker/Docker.d.ts +301 -0
- package/dist/cjs/docker/Docker.js +703 -0
- package/dist/cjs/docker/exceptions/DockerConnectionException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerConnectionException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageBuildException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImageBuildException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageImportException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImageImportException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
- package/dist/cjs/docker/exceptions/DockerImageNotFoundException.js +17 -0
- package/dist/cjs/docker/exceptions/DockerImagePullException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImagePullException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImagePushException.d.ts +8 -0
- package/dist/cjs/docker/exceptions/DockerImagePushException.js +15 -0
- package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
- package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.js +15 -0
- package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerRequestException.d.ts +22 -0
- package/dist/cjs/docker/exceptions/DockerRequestException.js +24 -0
- package/dist/cjs/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
- package/dist/cjs/docker/interfaces/IDockerConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerKeyObject.d.ts +14 -0
- package/dist/cjs/docker/interfaces/IDockerKeyObject.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
- package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.js +2 -0
- package/dist/cjs/docker/lib/DockerContainer.d.ts +315 -0
- package/dist/cjs/docker/lib/DockerContainer.js +742 -0
- package/dist/cjs/docker/lib/DockerContainerTTY.d.ts +99 -0
- package/dist/cjs/docker/lib/DockerContainerTTY.js +157 -0
- package/dist/cjs/docker/lib/DockerImage.d.ts +153 -0
- package/dist/cjs/docker/lib/DockerImage.js +273 -0
- package/dist/cjs/docker/lib/EngineSettings.d.ts +41 -0
- package/dist/cjs/docker/lib/EngineSettings.js +86 -0
- package/dist/cjs/docker/lib/ParseBaseImages.d.ts +9 -0
- package/dist/cjs/docker/lib/ParseBaseImages.js +50 -0
- package/dist/cjs/docker/lib/ParseEnvToRecord.d.ts +14 -0
- package/dist/cjs/docker/lib/ParseEnvToRecord.js +25 -0
- package/dist/cjs/docker/lib/ParseRepositoryTag.d.ts +17 -0
- package/dist/cjs/docker/lib/ParseRepositoryTag.js +48 -0
- package/dist/cjs/docker/lib/RegistryAuth.d.ts +8 -0
- package/dist/cjs/docker/lib/RegistryAuth.js +15 -0
- package/dist/cjs/docker/options/DockerPruneOptions.d.ts +38 -0
- package/dist/cjs/docker/options/DockerPruneOptions.js +47 -0
- package/dist/cjs/docker/options/auth/DockerAuthOptions.d.ts +46 -0
- package/dist/cjs/docker/options/auth/DockerAuthOptions.js +59 -0
- package/dist/cjs/docker/options/container/ContainerCommitOptions.d.ts +28 -0
- package/dist/cjs/docker/options/container/ContainerCommitOptions.js +39 -0
- package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
- package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.js +43 -0
- package/dist/cjs/docker/options/container/ContainerExecOptions.d.ts +26 -0
- package/dist/cjs/docker/options/container/ContainerExecOptions.js +38 -0
- package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
- package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.js +39 -0
- package/dist/cjs/docker/options/container/ContainerKillOptions.d.ts +25 -0
- package/dist/cjs/docker/options/container/ContainerKillOptions.js +36 -0
- package/dist/cjs/docker/options/container/ContainerLogsOptions.d.ts +48 -0
- package/dist/cjs/docker/options/container/ContainerLogsOptions.js +56 -0
- package/dist/cjs/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/cjs/docker/options/container/ContainerRemoveOptions.js +34 -0
- package/dist/cjs/docker/options/container/ContainerSettingOptions.d.ts +137 -0
- package/dist/cjs/docker/options/container/ContainerSettingOptions.js +136 -0
- package/dist/cjs/docker/options/container/ContainerStopOptions.d.ts +28 -0
- package/dist/cjs/docker/options/container/ContainerStopOptions.js +40 -0
- package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
- package/dist/cjs/docker/options/image/ImageBuildOptions.d.ts +117 -0
- package/dist/cjs/docker/options/image/ImageBuildOptions.js +111 -0
- package/dist/cjs/docker/options/image/ImageExportOptions.d.ts +33 -0
- package/dist/cjs/docker/options/image/ImageExportOptions.js +44 -0
- package/dist/cjs/docker/options/image/ImageImportOptions.d.ts +28 -0
- package/dist/cjs/docker/options/image/ImageImportOptions.js +42 -0
- package/dist/cjs/docker/options/image/ImagePullOptions.d.ts +49 -0
- package/dist/cjs/docker/options/image/ImagePullOptions.js +63 -0
- package/dist/cjs/docker/options/image/ImagePushOptions.d.ts +41 -0
- package/dist/cjs/docker/options/image/ImagePushOptions.js +56 -0
- package/dist/cjs/docker/options/image/ImageRemoveOptions.d.ts +26 -0
- package/dist/cjs/docker/options/image/ImageRemoveOptions.js +38 -0
- package/dist/cjs/docker/options/image/ImageTagOptions.d.ts +25 -0
- package/dist/cjs/docker/options/image/ImageTagOptions.js +38 -0
- package/dist/cjs/docker/options/network/NetworkCreateOptions.d.ts +54 -0
- package/dist/cjs/docker/options/network/NetworkCreateOptions.js +63 -0
- package/dist/cjs/docker/types/ContainerBind.d.ts +19 -0
- package/dist/cjs/docker/types/ContainerBind.js +2 -0
- package/dist/cjs/docker/types/ContainerCapability.d.ts +286 -0
- package/dist/cjs/docker/types/ContainerCapability.js +290 -0
- package/dist/cjs/docker/types/ContainerConfig.d.ts +67 -0
- package/dist/cjs/docker/types/ContainerConfig.js +2 -0
- package/dist/cjs/docker/types/ContainerDevice.d.ts +19 -0
- package/dist/cjs/docker/types/ContainerDevice.js +2 -0
- package/dist/cjs/docker/types/ContainerExecResult.d.ts +20 -0
- package/dist/cjs/docker/types/ContainerExecResult.js +2 -0
- package/dist/cjs/docker/types/ContainerNetwork.d.ts +46 -0
- package/dist/cjs/docker/types/ContainerNetwork.js +2 -0
- package/dist/cjs/docker/types/ContainerPort.d.ts +25 -0
- package/dist/cjs/docker/types/ContainerPort.js +2 -0
- package/dist/cjs/docker/types/ContainerRestartPolicy.d.ts +11 -0
- package/dist/cjs/docker/types/ContainerRestartPolicy.js +2 -0
- package/dist/cjs/docker/types/ContainerState.d.ts +48 -0
- package/dist/cjs/docker/types/ContainerState.js +2 -0
- package/dist/cjs/docker/types/ContainerStats.d.ts +408 -0
- package/dist/cjs/docker/types/ContainerStats.js +2 -0
- package/dist/cjs/docker/types/DockerOutputCallback.d.ts +8 -0
- package/dist/cjs/docker/types/DockerOutputCallback.js +2 -0
- package/dist/cjs/docker/types/ImageConfig.d.ts +34 -0
- package/dist/cjs/docker/types/ImageConfig.js +2 -0
- package/dist/cjs/docker/types/ImageExposePort.d.ts +17 -0
- package/dist/cjs/docker/types/ImageExposePort.js +2 -0
- package/dist/cjs/docker/types/NetworkInfo.d.ts +59 -0
- package/dist/cjs/docker/types/NetworkInfo.js +2 -0
- package/dist/cjs/docker/types/RepositoryTag.d.ts +15 -0
- package/dist/cjs/docker/types/RepositoryTag.js +2 -0
- package/dist/cjs/exports/Docker.d.ts +73 -0
- package/dist/cjs/exports/Docker.js +92 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/client/BuildContext.js +70 -0
- package/dist/esm/client/BuildKitProgress.js +190 -0
- package/dist/esm/client/DockerClient.js +307 -0
- package/dist/esm/client/DockerConnection.js +355 -0
- package/dist/esm/client/DockerIgnore.js +179 -0
- package/dist/esm/client/DockerRequestError.js +20 -0
- package/dist/esm/client/DockerStreams.js +111 -0
- package/dist/esm/client/types/ContainerCreateResponse.js +1 -0
- package/dist/esm/client/types/ContainerStopQuery.js +1 -0
- package/dist/esm/client/types/DeviceMapping.js +1 -0
- package/dist/esm/client/types/IdResponse.js +1 -0
- package/dist/esm/client/types/NetworkCreateResponse.js +1 -0
- package/dist/esm/client/types/PortBinding.js +1 -0
- package/dist/esm/docker/ConnectionOptionsBuilder.js +142 -0
- package/dist/esm/docker/Docker.js +697 -0
- package/dist/esm/docker/exceptions/DockerConnectionException.js +12 -0
- package/dist/esm/docker/exceptions/DockerContainerNotFoundException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageBuildException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageImportException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageNotFoundException.js +13 -0
- package/dist/esm/docker/exceptions/DockerImagePullException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImagePushException.js +11 -0
- package/dist/esm/docker/exceptions/DockerImageRepoTagNotFoundException.js +11 -0
- package/dist/esm/docker/exceptions/DockerNetworkNotFoundException.js +12 -0
- package/dist/esm/docker/exceptions/DockerRequestException.js +20 -0
- package/dist/esm/docker/interfaces/IDockerConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerHttpConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerHttpsConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerKeyObject.js +1 -0
- package/dist/esm/docker/interfaces/IDockerSSHConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerSocketConnectionOptions.js +1 -0
- package/dist/esm/docker/lib/DockerContainer.js +739 -0
- package/dist/esm/docker/lib/DockerContainerTTY.js +154 -0
- package/dist/esm/docker/lib/DockerImage.js +270 -0
- package/dist/esm/docker/lib/EngineSettings.js +78 -0
- package/dist/esm/docker/lib/ParseBaseImages.js +47 -0
- package/dist/esm/docker/lib/ParseEnvToRecord.js +22 -0
- package/dist/esm/docker/lib/ParseRepositoryTag.js +45 -0
- package/dist/esm/docker/lib/RegistryAuth.js +12 -0
- package/dist/esm/docker/options/DockerPruneOptions.js +43 -0
- package/dist/esm/docker/options/auth/DockerAuthOptions.js +55 -0
- package/dist/esm/docker/options/container/ContainerCommitOptions.js +35 -0
- package/dist/esm/docker/options/container/ContainerCreateTTYOptions.js +39 -0
- package/dist/esm/docker/options/container/ContainerExecOptions.js +34 -0
- package/dist/esm/docker/options/container/ContainerExportDirectoryOptions.js +35 -0
- package/dist/esm/docker/options/container/ContainerKillOptions.js +32 -0
- package/dist/esm/docker/options/container/ContainerLogsOptions.js +52 -0
- package/dist/esm/docker/options/container/ContainerRemoveOptions.js +30 -0
- package/dist/esm/docker/options/container/ContainerSettingOptions.js +132 -0
- package/dist/esm/docker/options/container/ContainerStopOptions.js +36 -0
- package/dist/esm/docker/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
- package/dist/esm/docker/options/image/ImageBuildOptions.js +107 -0
- package/dist/esm/docker/options/image/ImageExportOptions.js +40 -0
- package/dist/esm/docker/options/image/ImageImportOptions.js +38 -0
- package/dist/esm/docker/options/image/ImagePullOptions.js +59 -0
- package/dist/esm/docker/options/image/ImagePushOptions.js +52 -0
- package/dist/esm/docker/options/image/ImageRemoveOptions.js +34 -0
- package/dist/esm/docker/options/image/ImageTagOptions.js +34 -0
- package/dist/esm/docker/options/network/NetworkCreateOptions.js +59 -0
- package/dist/esm/docker/types/ContainerBind.js +1 -0
- package/dist/esm/docker/types/ContainerCapability.js +287 -0
- package/dist/esm/docker/types/ContainerConfig.js +1 -0
- package/dist/esm/docker/types/ContainerDevice.js +1 -0
- package/dist/esm/docker/types/ContainerExecResult.js +1 -0
- package/dist/esm/docker/types/ContainerNetwork.js +1 -0
- package/dist/esm/docker/types/ContainerPort.js +1 -0
- package/dist/esm/docker/types/ContainerRestartPolicy.js +1 -0
- package/dist/esm/docker/types/ContainerState.js +1 -0
- package/dist/esm/docker/types/ContainerStats.js +1 -0
- package/dist/esm/docker/types/DockerOutputCallback.js +1 -0
- package/dist/esm/docker/types/ImageConfig.js +1 -0
- package/dist/esm/docker/types/ImageExposePort.js +1 -0
- package/dist/esm/docker/types/NetworkInfo.js +1 -0
- package/dist/esm/docker/types/RepositoryTag.js +1 -0
- package/dist/esm/exports/Docker.js +73 -0
- package/dist/types/client/BuildContext.d.ts +22 -0
- package/dist/types/client/BuildKitProgress.d.ts +81 -0
- package/dist/types/client/DockerClient.d.ts +196 -0
- package/dist/types/client/DockerConnection.d.ts +154 -0
- package/dist/types/client/DockerIgnore.d.ts +44 -0
- package/dist/types/client/DockerRequestError.d.ts +17 -0
- package/dist/types/client/DockerStreams.d.ts +35 -0
- package/dist/types/client/types/ContainerCreateResponse.d.ts +7 -0
- package/dist/types/client/types/ContainerStopQuery.d.ts +13 -0
- package/dist/types/client/types/DeviceMapping.d.ts +8 -0
- package/dist/types/client/types/IdResponse.d.ts +6 -0
- package/dist/types/client/types/NetworkCreateResponse.d.ts +7 -0
- package/dist/types/client/types/PortBinding.d.ts +10 -0
- package/dist/types/docker/ConnectionOptionsBuilder.d.ts +128 -0
- package/dist/types/docker/Docker.d.ts +301 -0
- package/dist/types/docker/exceptions/DockerConnectionException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageBuildException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageImportException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
- package/dist/types/docker/exceptions/DockerImagePullException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImagePushException.d.ts +8 -0
- package/dist/types/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
- package/dist/types/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerRequestException.d.ts +22 -0
- package/dist/types/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
- package/dist/types/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerKeyObject.d.ts +14 -0
- package/dist/types/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
- package/dist/types/docker/lib/DockerContainer.d.ts +315 -0
- package/dist/types/docker/lib/DockerContainerTTY.d.ts +99 -0
- package/dist/types/docker/lib/DockerImage.d.ts +153 -0
- package/dist/types/docker/lib/EngineSettings.d.ts +41 -0
- package/dist/types/docker/lib/ParseBaseImages.d.ts +9 -0
- package/dist/types/docker/lib/ParseEnvToRecord.d.ts +14 -0
- package/dist/types/docker/lib/ParseRepositoryTag.d.ts +17 -0
- package/dist/types/docker/lib/RegistryAuth.d.ts +8 -0
- package/dist/types/docker/options/DockerPruneOptions.d.ts +38 -0
- package/dist/types/docker/options/auth/DockerAuthOptions.d.ts +46 -0
- package/dist/types/docker/options/container/ContainerCommitOptions.d.ts +28 -0
- package/dist/types/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
- package/dist/types/docker/options/container/ContainerExecOptions.d.ts +26 -0
- package/dist/types/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
- package/dist/types/docker/options/container/ContainerKillOptions.d.ts +25 -0
- package/dist/types/docker/options/container/ContainerLogsOptions.d.ts +48 -0
- package/dist/types/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/types/docker/options/container/ContainerSettingOptions.d.ts +137 -0
- package/dist/types/docker/options/container/ContainerStopOptions.d.ts +28 -0
- package/dist/types/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/types/docker/options/image/ImageBuildOptions.d.ts +117 -0
- package/dist/types/docker/options/image/ImageExportOptions.d.ts +33 -0
- package/dist/types/docker/options/image/ImageImportOptions.d.ts +28 -0
- package/dist/types/docker/options/image/ImagePullOptions.d.ts +49 -0
- package/dist/types/docker/options/image/ImagePushOptions.d.ts +41 -0
- package/dist/types/docker/options/image/ImageRemoveOptions.d.ts +26 -0
- package/dist/types/docker/options/image/ImageTagOptions.d.ts +25 -0
- package/dist/types/docker/options/network/NetworkCreateOptions.d.ts +54 -0
- package/dist/types/docker/types/ContainerBind.d.ts +19 -0
- package/dist/types/docker/types/ContainerCapability.d.ts +286 -0
- package/dist/types/docker/types/ContainerConfig.d.ts +67 -0
- package/dist/types/docker/types/ContainerDevice.d.ts +19 -0
- package/dist/types/docker/types/ContainerExecResult.d.ts +20 -0
- package/dist/types/docker/types/ContainerNetwork.d.ts +46 -0
- package/dist/types/docker/types/ContainerPort.d.ts +25 -0
- package/dist/types/docker/types/ContainerRestartPolicy.d.ts +11 -0
- package/dist/types/docker/types/ContainerState.d.ts +48 -0
- package/dist/types/docker/types/ContainerStats.d.ts +408 -0
- package/dist/types/docker/types/DockerOutputCallback.d.ts +8 -0
- package/dist/types/docker/types/ImageConfig.d.ts +34 -0
- package/dist/types/docker/types/ImageExposePort.d.ts +17 -0
- package/dist/types/docker/types/NetworkInfo.d.ts +59 -0
- package/dist/types/docker/types/RepositoryTag.d.ts +15 -0
- package/dist/types/exports/Docker.d.ts +73 -0
- package/package.json +57 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { Component } from '@lakutata/core';
|
|
2
|
+
import { DockerImage } from './lib/DockerImage.js';
|
|
3
|
+
import { DockerContainer } from './lib/DockerContainer.js';
|
|
4
|
+
import { ImagePullOptions } from './options/image/ImagePullOptions.js';
|
|
5
|
+
import { ImageBuildOptions } from './options/image/ImageBuildOptions.js';
|
|
6
|
+
import { IDockerKeyObject } from './interfaces/IDockerKeyObject.js';
|
|
7
|
+
import { ImageImportOptions } from './options/image/ImageImportOptions.js';
|
|
8
|
+
import { NetworkCreateOptions } from './options/network/NetworkCreateOptions.js';
|
|
9
|
+
import { NetworkInfo } from './types/NetworkInfo.js';
|
|
10
|
+
import { ContainerSettingOptions } from './options/container/ContainerSettingOptions.js';
|
|
11
|
+
import { DockerPruneOptions } from './options/DockerPruneOptions.js';
|
|
12
|
+
import { DockerAuthOptions } from './options/auth/DockerAuthOptions.js';
|
|
13
|
+
/**
|
|
14
|
+
* The Docker component: drives a Docker daemon over the Docker Engine API, to pull, build, import, export, tag and push
|
|
15
|
+
* images, to create, run and manage containers (exec, TTYs, logs, stats, commit, archives) and to manage networks.
|
|
16
|
+
* Register it in the `components` of an application (`{class: Docker}`, or the result of one of the
|
|
17
|
+
* `BuildDocker*ConnectionOptions` functions) and get it with `getObject()` or `@Inject`; it is a singleton.
|
|
18
|
+
*
|
|
19
|
+
* Without `socketPath` nor `host`, it connects to the Docker of the environment: `DOCKER_HOST` (with
|
|
20
|
+
* `DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH` and `DOCKER_CLIENT_TIMEOUT`), else the named pipe `//./pipe/docker_engine` on
|
|
21
|
+
* Windows, the socket of Docker Desktop (`~/.docker/run/docker.sock`) when it exists, or `/var/run/docker.sock`; the
|
|
22
|
+
* other options given (`timeout`, `headers`, `version`…) apply over the environment's. No Docker CLI is needed locally
|
|
23
|
+
* (the SSH connections need it on the remote host).
|
|
24
|
+
*
|
|
25
|
+
* When it is created, the component pings the daemon and negotiates the API version (the newest one supported by both,
|
|
26
|
+
* from 1.41 to 1.56): a daemon which cannot be reached fails its creation with {@link DockerConnectionException}.
|
|
27
|
+
* Afterwards, a daemon which cannot be reached rejects the calls with the network error of Node.js (`ECONNREFUSED`,
|
|
28
|
+
* `ENOENT`…). A request the daemon refuses rejects with the exception of what is missing
|
|
29
|
+
* ({@link DockerContainerNotFoundException}, {@link DockerImageNotFoundException},
|
|
30
|
+
* {@link DockerNetworkNotFoundException}), else with a {@link DockerRequestException}, whose `statusCode` is the HTTP
|
|
31
|
+
* status and whose message is the daemon's. The pulls, builds, imports and pushes wrap their failures in their own
|
|
32
|
+
* exceptions ({@link DockerImagePullException}…).
|
|
33
|
+
*
|
|
34
|
+
* When the component is destroyed (the application stopping), the pulls and builds in progress are aborted (they reject
|
|
35
|
+
* with their exception), the listings in progress resolve with an empty list, and its connections are closed.
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import {Application} from 'lakutata'
|
|
39
|
+
* import {Docker, type DockerContainer, type DockerImage} from 'lakutata/com/docker'
|
|
40
|
+
*
|
|
41
|
+
* Application
|
|
42
|
+
* .run(() => ({
|
|
43
|
+
* id: 'docker.app',
|
|
44
|
+
* name: 'Docker',
|
|
45
|
+
* components: {
|
|
46
|
+
* //The Docker of the environment: DOCKER_HOST, else the local socket
|
|
47
|
+
* docker: {class: Docker}
|
|
48
|
+
* }
|
|
49
|
+
* }))
|
|
50
|
+
* .onLaunched(async (app: Application): Promise<void> => {
|
|
51
|
+
* const docker: Docker = await app.getObject('docker')
|
|
52
|
+
* const image: DockerImage = await docker.pullImage({repo: 'alpine', tag: '3.20'})
|
|
53
|
+
* //Created, then started
|
|
54
|
+
* const container: DockerContainer = await image.run({name: 'hello', cmd: ['sleep', '60']})
|
|
55
|
+
* console.log((await container.exec({cmd: ['echo', 'hello']})).stdout)
|
|
56
|
+
* await container.remove({force: true})
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare class Docker extends Component {
|
|
61
|
+
#private;
|
|
62
|
+
/**
|
|
63
|
+
* The path of the daemon's Unix socket (`/var/run/docker.sock`), or of its named pipe on Windows
|
|
64
|
+
* (`//./pipe/docker_engine`). When set, `host` and `port` are ignored.
|
|
65
|
+
* @default undefined (the Docker of the environment, see {@link Docker})
|
|
66
|
+
*/
|
|
67
|
+
protected readonly socketPath?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* The host name or IP address of the daemon, reached over TCP (`protocol` `'http'` or `'https'`) or SSH
|
|
70
|
+
* (`'ssh'`).
|
|
71
|
+
* @default undefined (the Docker of the environment, see {@link Docker})
|
|
72
|
+
*/
|
|
73
|
+
protected readonly host?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* The port of the daemon on `host`: by convention 2375 over HTTP and 2376 over HTTPS; the SSH port for `'ssh'`.
|
|
76
|
+
* @default undefined (80 over HTTP, 443 over HTTPS, 22 over SSH)
|
|
77
|
+
*/
|
|
78
|
+
protected readonly port?: number | string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The user of the SSH connections. There is no password: the SSH connection authenticates through the SSH agent
|
|
81
|
+
* (see `sshAuthAgent`).
|
|
82
|
+
* @default undefined
|
|
83
|
+
*/
|
|
84
|
+
protected readonly username?: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* The HTTP headers added to every request sent to the daemon (a proxy's credentials…), the Docker of the
|
|
87
|
+
* environment's included.
|
|
88
|
+
* @default undefined
|
|
89
|
+
*/
|
|
90
|
+
protected readonly headers?: {
|
|
91
|
+
[name: string]: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* The certificates of the authorities trusted for the daemon's HTTPS certificate: their PEM contents, not their file
|
|
95
|
+
* paths.
|
|
96
|
+
* @default undefined (the authorities of Node.js)
|
|
97
|
+
*/
|
|
98
|
+
protected readonly ca?: string | string[] | Buffer | Buffer[] | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* The client certificate of the HTTPS connections (its PEM contents), for a daemon verifying its clients
|
|
101
|
+
* (`--tlsverify`).
|
|
102
|
+
* @default undefined
|
|
103
|
+
*/
|
|
104
|
+
protected readonly cert?: string | string[] | Buffer | Buffer[] | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* The private key of `cert` (its PEM contents), or keys with their passphrases ({@link IDockerKeyObject}).
|
|
107
|
+
* @default undefined
|
|
108
|
+
*/
|
|
109
|
+
protected readonly key?: string | string[] | Buffer | Buffer[] | IDockerKeyObject[] | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* How `host` is reached: `'http'`, `'https'` (with `ca`, `cert` and `key`), or `'ssh'`. Over SSH, the requests
|
|
112
|
+
* go through `docker system dial-stdio` run on the remote host (which needs the Docker CLI), and the optional package
|
|
113
|
+
* `ssh2` must be installed, otherwise the component's creation fails with {@link DockerConnectionException}.
|
|
114
|
+
* Ignored with `socketPath`.
|
|
115
|
+
* @default 'https' when `ca`, `cert` and `key` are all given, 'http' otherwise
|
|
116
|
+
*/
|
|
117
|
+
protected readonly protocol?: 'https' | 'http' | 'ssh' | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* How long a request may stay idle (no data received), in milliseconds; the request then fails with the error
|
|
120
|
+
* "Timeout of … ms exceeded". It also applies to the streams (a followed log with no output for that long fails),
|
|
121
|
+
* and to the Docker of the environment (over its `DOCKER_CLIENT_TIMEOUT`).
|
|
122
|
+
* @default undefined (no timeout, or the environment's `DOCKER_CLIENT_TIMEOUT`)
|
|
123
|
+
*/
|
|
124
|
+
protected readonly timeout?: number | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* The version of the Docker Engine API used by the requests (`'1.47'` or `'v1.47'`).
|
|
127
|
+
* @default undefined (negotiated with the daemon: the newest version both support)
|
|
128
|
+
*/
|
|
129
|
+
protected readonly version?: string | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* The path of the SSH agent's socket, which authenticates the SSH connections.
|
|
132
|
+
* @default undefined (the `SSH_AUTH_SOCK` environment variable)
|
|
133
|
+
*/
|
|
134
|
+
protected readonly sshAuthAgent?: string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Connect to the daemon: ping it, then negotiate the API version.
|
|
137
|
+
* @throws {DockerConnectionException} When the daemon cannot be reached or does not answer, or when an SSH
|
|
138
|
+
* connection is configured without the package `ssh2`.
|
|
139
|
+
* @protected
|
|
140
|
+
*/
|
|
141
|
+
protected init(): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Abort the pulls, builds and listings in progress (the pulls and builds then reject), then close the connections
|
|
144
|
+
* to the daemon.
|
|
145
|
+
* @protected
|
|
146
|
+
*/
|
|
147
|
+
protected destroy(): Promise<void>;
|
|
148
|
+
/** Docker Common Operations **/
|
|
149
|
+
/**
|
|
150
|
+
* Remove the daemon's unused resources, as `docker <kind> prune` does without options: the stopped containers, then
|
|
151
|
+
* the dangling images (untagged and unused), the unused networks and the unused anonymous volumes. Without
|
|
152
|
+
* options, the containers and the images are pruned; the networks and the volumes only when asked.
|
|
153
|
+
* @param options The kinds of resources pruned: `containers` and `images` default to `true`, `networks` and
|
|
154
|
+
* `volumes` to `false`.
|
|
155
|
+
* @throws {InvalidMethodAcceptException} When the options are invalid.
|
|
156
|
+
* @throws {DockerRequestException} When the daemon refuses a prune (one already running: HTTP 409).
|
|
157
|
+
*/
|
|
158
|
+
prune(options?: DockerPruneOptions): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Check credentials against a registry, as `docker login` does. The credentials are not kept: each pull, build or
|
|
161
|
+
* push which needs them is given its own `auth`.
|
|
162
|
+
* @param options The registry (`serverAddress`, a host name without protocol: `registry.example.com:5000`) and its
|
|
163
|
+
* credentials (a password, or a token).
|
|
164
|
+
* @throws {DockerRequestException} When the registry refuses the credentials or cannot be reached (the daemon's
|
|
165
|
+
* status: HTTP 401, 500).
|
|
166
|
+
*/
|
|
167
|
+
loginRepository(options: DockerAuthOptions): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Whether a registry accepts credentials ({@link Docker.loginRepository} without its error).
|
|
170
|
+
* @param options The registry (`serverAddress`, a host name without protocol) and its credentials.
|
|
171
|
+
* @returns `true` when they are accepted; `false` on any failure, the daemon unreachable included.
|
|
172
|
+
*/
|
|
173
|
+
checkRepositoryAuth(options: DockerAuthOptions): Promise<boolean>;
|
|
174
|
+
/** Docker Image Operations **/
|
|
175
|
+
/**
|
|
176
|
+
* List the daemon's images (as `docker images`, without the intermediate ones). Each image is inspected with a request
|
|
177
|
+
* of its own, so the call costs one request per image; an image removed during the listing is not listed.
|
|
178
|
+
* @returns The images, in the daemon's order.
|
|
179
|
+
*/
|
|
180
|
+
listImages(): Promise<DockerImage[]>;
|
|
181
|
+
/**
|
|
182
|
+
* Pull an image from its registry, as `docker pull`, and wait for its end.
|
|
183
|
+
* @param options The repository (`alpine`, `registry.example.com:5000/team/app`), the tag (`'latest'` by default),
|
|
184
|
+
* the platform (`linux/arm64`, the daemon's by default), the registry credentials, and a callback receiving each
|
|
185
|
+
* progress message.
|
|
186
|
+
* @returns The image pulled, found as `repo:tag` the way the daemon names it (`docker.io/library/alpine` is
|
|
187
|
+
* `alpine`).
|
|
188
|
+
* @throws {DockerImagePullException} When the pull fails: the image or the registry not found, refused credentials,
|
|
189
|
+
* the daemon unreachable, or the component destroyed during the pull (its message then says it was aborted).
|
|
190
|
+
*/
|
|
191
|
+
pullImage(options: ImagePullOptions): Promise<DockerImage>;
|
|
192
|
+
/**
|
|
193
|
+
* Build an image with BuildKit, as `docker build`, and wait for its end. The build context is made of the `files`
|
|
194
|
+
* of the `workdir` (relative paths; a directory with its content), without the ones its `.dockerignore` excludes,
|
|
195
|
+
* and always with the Dockerfile. The progress is given to the output callback as the lines of
|
|
196
|
+
* `docker build --progress=plain` (`{id: 'moby.buildkit.trace', stream: '#2 [1/2] FROM alpine'}`).
|
|
197
|
+
*
|
|
198
|
+
* With `auth`, the base images of the Dockerfile (its `FROM` lines) are pulled first with these credentials, as
|
|
199
|
+
* BuildKit is not given them.
|
|
200
|
+
* @param options The context (`workdir`, `files`), the Dockerfile, the name of the image (`repoTag`; a generated
|
|
201
|
+
* `unnamed_img_…` name by default), the platform, the target stage, the build arguments, the registry credentials
|
|
202
|
+
* and the output callback.
|
|
203
|
+
* @returns The image built.
|
|
204
|
+
* @throws {DockerImageBuildException} When the build fails: a step failing, the Dockerfile or a file of the context
|
|
205
|
+
* missing, a base image which cannot be pulled, the daemon unreachable, or the component destroyed during the build
|
|
206
|
+
* (its message then says it was aborted).
|
|
207
|
+
*/
|
|
208
|
+
buildImage(options: ImageBuildOptions): Promise<DockerImage>;
|
|
209
|
+
/**
|
|
210
|
+
* Load an image from a tar archive written by `docker save` (or {@link DockerImage.export}), as `docker load`. The
|
|
211
|
+
* tags saved in the archive are restored.
|
|
212
|
+
* @param options The archive (`source`, a file path or a readable stream) and `quiet` (`false` by default).
|
|
213
|
+
* @returns The image loaded.
|
|
214
|
+
* @throws {DockerImageImportException} When the daemon rejects the archive, or when the loaded image is unknown.
|
|
215
|
+
* @throws {Error} The error of the source when it cannot be read (`ENOENT` for a missing file), or the network
|
|
216
|
+
* error when the archive cannot be sent.
|
|
217
|
+
* @throws {DockerRequestException} When the daemon refuses the request.
|
|
218
|
+
*/
|
|
219
|
+
importImage(options: ImageImportOptions): Promise<DockerImage>;
|
|
220
|
+
/**
|
|
221
|
+
* Get an image by its ID or its name, resolved by the daemon as `docker image inspect` does: the full ID
|
|
222
|
+
* (`sha256:…`), a unique prefix of it (`d9e853e8`), a tag (`alpine:3.20`), a name without its tag for `:latest`
|
|
223
|
+
* (`alpine`), a name with its registry (`docker.io/library/alpine:3.20`) or a digest (`alpine@sha256:…`).
|
|
224
|
+
* @param repoTagOrId The ID, the short ID, the name or the digest of the image.
|
|
225
|
+
* @returns The image.
|
|
226
|
+
* @throws {DockerImageNotFoundException} When the daemon finds no image with this ID or name.
|
|
227
|
+
*/
|
|
228
|
+
getImage(repoTagOrId: string): Promise<DockerImage>;
|
|
229
|
+
/** Docker Container Operations **/
|
|
230
|
+
/**
|
|
231
|
+
* List the daemon's containers, the stopped ones included (as `docker ps -a`). Each container is inspected, with its
|
|
232
|
+
* image (see {@link Docker.getContainer}); a container removed during the listing is not listed.
|
|
233
|
+
* @returns The containers; an empty list when the component is destroyed during the call.
|
|
234
|
+
*/
|
|
235
|
+
listContainers(): Promise<DockerContainer[]>;
|
|
236
|
+
/**
|
|
237
|
+
* Get a container by its ID, short ID or name, inspected with its image (`image` is `undefined` when its image no
|
|
238
|
+
* longer exists, removed with force). The object is a snapshot: its properties are refreshed by its own operations
|
|
239
|
+
* (`start()`, `stop()`…), not by the changes made by others.
|
|
240
|
+
* @param id The ID, a unique prefix of it, or the name of the container.
|
|
241
|
+
* @returns The container.
|
|
242
|
+
* @throws {DockerContainerNotFoundException} When the daemon has no such container.
|
|
243
|
+
*/
|
|
244
|
+
getContainer(id: string): Promise<DockerContainer>;
|
|
245
|
+
/**
|
|
246
|
+
* Create a container from an image, as `docker create`: it is not started (see {@link DockerContainer.start}, or
|
|
247
|
+
* {@link DockerImage.run} to create and start it).
|
|
248
|
+
* @param imageId The ID or the name (`alpine:3.20`) of a local image: it is not pulled.
|
|
249
|
+
* @param options The container's settings: name, command, environment, ports, binds, devices, networks, limits…
|
|
250
|
+
* @returns The container created.
|
|
251
|
+
* @throws {DockerImageNotFoundException} When the image is not found.
|
|
252
|
+
* @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
|
|
253
|
+
* @throws {DockerRequestException} When the daemon refuses the settings: the name already used (HTTP 409), an
|
|
254
|
+
* invalid setting (HTTP 400).
|
|
255
|
+
* @throws {InvalidMethodAcceptException} When the settings are invalid.
|
|
256
|
+
*/
|
|
257
|
+
createContainer(imageId: string, options: ContainerSettingOptions): Promise<DockerContainer>;
|
|
258
|
+
/**
|
|
259
|
+
* Create a container from an image for a platform, as `docker create --platform`: it is not started.
|
|
260
|
+
* @param imageId The ID or the name (`alpine:3.20`) of a local image: it is not pulled.
|
|
261
|
+
* @param platform The platform of the image used (`linux/arm64`), for an image having several.
|
|
262
|
+
* @param options The container's settings: name, command, environment, ports, binds, devices, networks, limits…
|
|
263
|
+
* @returns The container created.
|
|
264
|
+
* @throws {DockerImageNotFoundException} When the image is not found for the platform.
|
|
265
|
+
* @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
|
|
266
|
+
* @throws {DockerRequestException} When the daemon refuses the settings: the name already used (HTTP 409), an
|
|
267
|
+
* invalid setting (HTTP 400).
|
|
268
|
+
* @throws {InvalidMethodAcceptException} When the settings are invalid.
|
|
269
|
+
*/
|
|
270
|
+
createContainer(imageId: string, platform: string, options: ContainerSettingOptions): Promise<DockerContainer>;
|
|
271
|
+
/** Docker Network Operations **/
|
|
272
|
+
/**
|
|
273
|
+
* Create a network, as `docker network create`.
|
|
274
|
+
* @param options The name, the driver (`'bridge'` by default, `'ipvlan'`, `'macvlan'`), its options, the subnets
|
|
275
|
+
* (`NetworkIPAMConfigs`; chosen by the daemon when empty or absent), `internal` and `enableIPv6`.
|
|
276
|
+
* @returns The network created.
|
|
277
|
+
* @throws {DockerRequestException} When the daemon refuses the network: the name already used (HTTP 409), a subnet
|
|
278
|
+
* overlapping another network's (HTTP 400).
|
|
279
|
+
*/
|
|
280
|
+
createNetwork(options: NetworkCreateOptions): Promise<NetworkInfo>;
|
|
281
|
+
/**
|
|
282
|
+
* Remove a network, as `docker network rm`.
|
|
283
|
+
* @param id The ID, a unique prefix of it, or the name of the network.
|
|
284
|
+
* @throws {DockerNetworkNotFoundException} When the daemon has no such network.
|
|
285
|
+
* @throws {DockerRequestException} When the network has containers connected (HTTP 409), or is reserved (`bridge`,
|
|
286
|
+
* `host`, `none`: HTTP 403).
|
|
287
|
+
*/
|
|
288
|
+
removeNetwork(id: string): Promise<void>;
|
|
289
|
+
/**
|
|
290
|
+
* List the daemon's networks, the reserved ones (`bridge`, `host`, `none`) included.
|
|
291
|
+
* @returns The networks; an empty list when the component is destroyed during the call.
|
|
292
|
+
*/
|
|
293
|
+
listNetworks(): Promise<NetworkInfo[]>;
|
|
294
|
+
/**
|
|
295
|
+
* Get a network by its ID, a unique prefix of it, or its name, as `docker network inspect`.
|
|
296
|
+
* @param id The ID, a unique prefix of it, or the name of the network.
|
|
297
|
+
* @returns The network.
|
|
298
|
+
* @throws {DockerNetworkNotFoundException} When the daemon has no such network.
|
|
299
|
+
*/
|
|
300
|
+
getNetwork(id: string): Promise<NetworkInfo>;
|
|
301
|
+
}
|