@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,315 @@
|
|
|
1
|
+
import { Provider } from '@lakutata/core';
|
|
2
|
+
import type { DockerClient } from '../../client/DockerClient.js';
|
|
3
|
+
import { Time } from '@lakutata/utils/Time';
|
|
4
|
+
import { ContainerState } from '../types/ContainerState.js';
|
|
5
|
+
import { type Docker } from '../Docker.js';
|
|
6
|
+
import { type DockerImage } from './DockerImage.js';
|
|
7
|
+
import { ContainerNetwork } from '../types/ContainerNetwork.js';
|
|
8
|
+
import { ContainerPort } from '../types/ContainerPort.js';
|
|
9
|
+
import { ContainerBind } from '../types/ContainerBind.js';
|
|
10
|
+
import { ContainerDevice } from '../types/ContainerDevice.js';
|
|
11
|
+
import { ContainerStopOptions } from '../options/container/ContainerStopOptions.js';
|
|
12
|
+
import { ContainerRemoveOptions } from '../options/container/ContainerRemoveOptions.js';
|
|
13
|
+
import { ContainerSettingOptions } from '../options/container/ContainerSettingOptions.js';
|
|
14
|
+
import { ContainerRestartPolicy } from '../types/ContainerRestartPolicy.js';
|
|
15
|
+
import { type ContainerExecResult } from '../types/ContainerExecResult.js';
|
|
16
|
+
import { ContainerKillOptions } from '../options/container/ContainerKillOptions.js';
|
|
17
|
+
import { ContainerCommitOptions } from '../options/container/ContainerCommitOptions.js';
|
|
18
|
+
import { ContainerCapability } from '../types/ContainerCapability.js';
|
|
19
|
+
import { DockerContainerTTY } from './DockerContainerTTY.js';
|
|
20
|
+
import { ContainerCreateTTYOptions } from '../options/container/ContainerCreateTTYOptions.js';
|
|
21
|
+
import { ContainerLogsOptions } from '../options/container/ContainerLogsOptions.js';
|
|
22
|
+
import { ContainerStats } from '../types/ContainerStats.js';
|
|
23
|
+
import { ContainerExecOptions } from '../options/container/ContainerExecOptions.js';
|
|
24
|
+
import { ContainerExportDirectoryOptions } from '../options/container/ContainerExportDirectoryOptions.js';
|
|
25
|
+
/**
|
|
26
|
+
* A container of the Docker daemon, with its settings and its state as inspected, and its operations: start, stop,
|
|
27
|
+
* restart, pause, kill, remove, update, commit, exec, TTYs, logs, stats and the export of its files. It is not created
|
|
28
|
+
* with `new`: {@link Docker.getContainer}, {@link Docker.listContainers}, {@link Docker.createContainer} and
|
|
29
|
+
* {@link DockerImage.run} return it.
|
|
30
|
+
*
|
|
31
|
+
* Its properties are a snapshot, taken when it is obtained and refreshed by its own operations (`start()`, `stop()`,
|
|
32
|
+
* `restart()`, `pause()`, `unpause()`, `kill()`, `update()`): the changes made by others (the container exiting,
|
|
33
|
+
* `docker stop`) are seen by getting it again. Its operations reject with {@link DockerContainerNotFoundException} when
|
|
34
|
+
* the container was removed, with {@link DockerRequestException} when the daemon refuses them otherwise (not running:
|
|
35
|
+
* HTTP 409), and with the network error of Node.js when the daemon cannot be reached.
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import {type Docker, type DockerContainer, type DockerImage} from 'lakutata/com/docker'
|
|
39
|
+
*
|
|
40
|
+
* declare const docker: Docker
|
|
41
|
+
*
|
|
42
|
+
* const image: DockerImage = await docker.getImage('alpine:3.20')
|
|
43
|
+
* const container: DockerContainer = await docker.createContainer(image.id, {
|
|
44
|
+
* name: 'worker',
|
|
45
|
+
* cmd: ['sh', '-c', 'echo started; sleep 3600'],
|
|
46
|
+
* env: {MODE: 'production'},
|
|
47
|
+
* ports: [{port: 8080, type: 'tcp', hostPorts: [18080]}],
|
|
48
|
+
* binds: [{hostPath: '/srv/data', containerPath: '/data', rw: true}],
|
|
49
|
+
* restartPolicy: 'unless-stopped'
|
|
50
|
+
* })
|
|
51
|
+
* await container.start()
|
|
52
|
+
* console.log(container.state.status, container.ports)
|
|
53
|
+
* //The exit code, stdout and stderr
|
|
54
|
+
* const {exitCode, stdout} = await container.exec({cmd: ['ls', '/data']})
|
|
55
|
+
* console.log(exitCode, stdout)
|
|
56
|
+
* await container.stop({timeout: 10})
|
|
57
|
+
* await container.remove()
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare class DockerContainer extends Provider {
|
|
61
|
+
#private;
|
|
62
|
+
/**
|
|
63
|
+
* Give the client of the Engine API: set by the {@link Docker} component creating the object.
|
|
64
|
+
*/
|
|
65
|
+
protected readonly getClient: () => DockerClient;
|
|
66
|
+
/**
|
|
67
|
+
* Give the {@link Docker} component which created the object.
|
|
68
|
+
*/
|
|
69
|
+
protected readonly getDocker: () => Docker;
|
|
70
|
+
/**
|
|
71
|
+
* The full ID of the container (64 hexadecimal characters). It changes when {@link DockerContainer.update}
|
|
72
|
+
* recreates the container.
|
|
73
|
+
*/
|
|
74
|
+
id: string;
|
|
75
|
+
/**
|
|
76
|
+
* The name of the container, without the leading `/` of the Engine API.
|
|
77
|
+
*/
|
|
78
|
+
name: string;
|
|
79
|
+
/**
|
|
80
|
+
* The host name of the container (its short ID unless set when it was created).
|
|
81
|
+
*/
|
|
82
|
+
hostname: string;
|
|
83
|
+
/**
|
|
84
|
+
* The image the container was created from; `undefined` when it no longer exists (removed with force while the
|
|
85
|
+
* container was stopped).
|
|
86
|
+
*/
|
|
87
|
+
image: DockerImage | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* How many times the daemon restarted the container, by its restart policy.
|
|
90
|
+
*/
|
|
91
|
+
restartCount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the container has full access to the host (`--privileged`).
|
|
94
|
+
*/
|
|
95
|
+
privileged: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the container's main process has a TTY: its logs are then raw, not split into stdout and stderr.
|
|
98
|
+
*/
|
|
99
|
+
tty: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The environment variables of the container, the image's included, by name.
|
|
102
|
+
*/
|
|
103
|
+
env: Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* The memory limit of the container, in bytes; `0` for no limit.
|
|
106
|
+
*/
|
|
107
|
+
memoryLimit: number;
|
|
108
|
+
/**
|
|
109
|
+
* The indexes of the CPUs the container may run on, sorted; empty for all of them.
|
|
110
|
+
*/
|
|
111
|
+
cpuSet: number[];
|
|
112
|
+
/**
|
|
113
|
+
* When the daemon restarts the container after it exits (`'no'` by default; `'on-failure:3'` for 3 retries at
|
|
114
|
+
* most).
|
|
115
|
+
*/
|
|
116
|
+
restartPolicy: ContainerRestartPolicy;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the OOM killer is disabled for the container.
|
|
119
|
+
*/
|
|
120
|
+
OOMKillDisable: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The kernel capabilities added to the container (`--cap-add`).
|
|
123
|
+
*/
|
|
124
|
+
capabilities: ContainerCapability[];
|
|
125
|
+
/**
|
|
126
|
+
* The state of the container: its status (`'created'`, `'running'`, `'exited'`…), its process ID, its exit code
|
|
127
|
+
* and its start and finish times.
|
|
128
|
+
*/
|
|
129
|
+
state: ContainerState;
|
|
130
|
+
/**
|
|
131
|
+
* The ports of the container, exposed by its image or published: one entry per IP address of the container, port
|
|
132
|
+
* and protocol, with the ports of the host published to it, each one once (empty when not published).
|
|
133
|
+
*/
|
|
134
|
+
ports: ContainerPort[];
|
|
135
|
+
/**
|
|
136
|
+
* The directories and files of the host mounted in the container (the bind mounts; not the volumes).
|
|
137
|
+
*/
|
|
138
|
+
binds: ContainerBind[];
|
|
139
|
+
/**
|
|
140
|
+
* The devices of the host added to the container.
|
|
141
|
+
*/
|
|
142
|
+
devices: ContainerDevice[];
|
|
143
|
+
/**
|
|
144
|
+
* The networks the container is connected to, with its addresses in each.
|
|
145
|
+
*/
|
|
146
|
+
networks: ContainerNetwork[];
|
|
147
|
+
/**
|
|
148
|
+
* The cgroup the container joins (`container:<name|id>`), as the daemon reports it (an empty string by default).
|
|
149
|
+
*/
|
|
150
|
+
cgroup: string | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* The parent cgroup under which the container's cgroup is created (an empty string by default).
|
|
153
|
+
*/
|
|
154
|
+
cgroupParent: string | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* The PID namespace mode of the container: `'host'`, `'container:<name|id>'`, or an empty string for its own.
|
|
157
|
+
*/
|
|
158
|
+
pidMode: string | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* When the container was created.
|
|
161
|
+
*/
|
|
162
|
+
createdAt: Time;
|
|
163
|
+
/**
|
|
164
|
+
* Inspect the container.
|
|
165
|
+
* @throws {DockerContainerNotFoundException} When the container does not exist.
|
|
166
|
+
* @protected
|
|
167
|
+
*/
|
|
168
|
+
protected init(): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Abort the requests in progress of the object (the container itself is left as it is).
|
|
171
|
+
* @protected
|
|
172
|
+
*/
|
|
173
|
+
protected destroy(): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Refresh the properties from the daemon's inspection of the container, and its image (`undefined` when it no longer
|
|
176
|
+
* exists).
|
|
177
|
+
* @throws {DockerContainerNotFoundException} When the container does not exist.
|
|
178
|
+
* @protected
|
|
179
|
+
*/
|
|
180
|
+
protected syncContainerInfo(): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Start the container, as `docker start`, then refresh its properties. A container already running is left as it is
|
|
183
|
+
* (as the Docker CLI does).
|
|
184
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
185
|
+
* @throws {DockerRequestException} When it fails to start (HTTP 500: a command not found, a port already used).
|
|
186
|
+
*/
|
|
187
|
+
start(): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Stop the container, as `docker stop`: send its stop signal, wait for it to exit, kill it after the timeout; then
|
|
190
|
+
* refresh its properties.
|
|
191
|
+
* @param options The signal sent (the container's stop signal, `SIGTERM` by default) and the timeout before the kill,
|
|
192
|
+
* in seconds (the container's, 10 by default). A container already stopped is left as it is (as the Docker CLI does).
|
|
193
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
194
|
+
*/
|
|
195
|
+
stop(options?: ContainerStopOptions): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Suspend the processes of the container, as `docker pause`, then refresh its properties.
|
|
198
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
199
|
+
* @throws {DockerRequestException} When it is not running or already paused (HTTP 409).
|
|
200
|
+
*/
|
|
201
|
+
pause(): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Resume the processes of a paused container, as `docker unpause`, then refresh its properties.
|
|
204
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
205
|
+
* @throws {DockerRequestException} When it is not paused (HTTP 409).
|
|
206
|
+
*/
|
|
207
|
+
unpause(): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Restart the container, as `docker restart`: stop it as {@link DockerContainer.stop} does (when it runs), then start
|
|
210
|
+
* it; then refresh its properties.
|
|
211
|
+
* @param options The signal sent (the container's stop signal, `SIGTERM` by default) and the timeout before the kill,
|
|
212
|
+
* in seconds (the container's, 10 by default).
|
|
213
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
214
|
+
* @throws {DockerRequestException} When it fails to start (HTTP 500).
|
|
215
|
+
*/
|
|
216
|
+
restart(options?: ContainerStopOptions): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Remove the container, as `docker rm -v`: its anonymous volumes are removed with it. The object is not refreshed:
|
|
219
|
+
* its other operations then fail with {@link DockerContainerNotFoundException}.
|
|
220
|
+
* @param options `force` kills a running container first (`false` by default).
|
|
221
|
+
* @throws {DockerContainerNotFoundException} When the container was already removed.
|
|
222
|
+
* @throws {DockerRequestException} When it is running and `force` is not set (HTTP 409).
|
|
223
|
+
*/
|
|
224
|
+
remove(options?: ContainerRemoveOptions): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Change the settings of the container, keeping the others. The memory limit, the CPUs and the restart policy are
|
|
227
|
+
* changed live, as `docker update` does, and the name by renaming it, the container running on. The other
|
|
228
|
+
* settings (and removing the memory limit or the CPU set, which Docker cannot do live) recreate the container: a new
|
|
229
|
+
* one is created from the old one's whole configuration (its image, command, entrypoint, environment, mounts,
|
|
230
|
+
* networks and their static addresses, the addresses Docker assigned being assigned again), with the settings
|
|
231
|
+
* changed, under a temporary name. Once created (and, when the old one was running, the old one stopped and the new
|
|
232
|
+
* one started), the old one is removed without its volumes and the new one takes its name (and its anonymous
|
|
233
|
+
* volumes, mounted again). The object follows the new container: its `id` changes.
|
|
234
|
+
* @remarks The old container is kept when the creation or the start of the new one fails (invalid settings, the
|
|
235
|
+
* image removed, a network missing): the new one is removed, the old one started again when it was running, and the
|
|
236
|
+
* call rejects. Its files outside the volumes are not kept by a recreation (commit them first, see
|
|
237
|
+
* {@link DockerContainer.commit}). A container removed by Docker when it stops (`AutoRemove`) cannot be kept.
|
|
238
|
+
* @param options The settings changed: `memoryLimit`, `cpuSet` and `restartPolicy` live (the swap limit set to
|
|
239
|
+
* Docker's default with the memory), `name` by a renaming; `hostname`, `env` (replacing the container's variables;
|
|
240
|
+
* the image's are added again), `cmd`, `entrypoint`, `tty`, `privileged`, `ports`, `binds` (replacing the bind
|
|
241
|
+
* mounts, the volumes kept), `devices`, `networks` (replacing the networks), `capabilities`, `OOMKillDisable`,
|
|
242
|
+
* `cgroup`, `cgroupParent` and `pidMode` by a recreation. The settings absent are kept.
|
|
243
|
+
* @throws {InvalidMethodAcceptException} When the settings are invalid.
|
|
244
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
245
|
+
* @throws {DockerImageNotFoundException} When the container must be recreated and its image no longer exists.
|
|
246
|
+
* @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
|
|
247
|
+
* @throws {DockerRequestException} When the daemon refuses the changes: a limit refused (HTTP 400), the name
|
|
248
|
+
* already used (HTTP 409), the new container failing to start (HTTP 500).
|
|
249
|
+
*/
|
|
250
|
+
update(options: ContainerSettingOptions): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Create an image from the container's current files, as `docker commit`.
|
|
253
|
+
* @param options The name of the image (`repoTag`, `repo:tag`; none by default) and whether the container is paused
|
|
254
|
+
* while it is committed (`pauseBeforeCommitting`, `true` by default).
|
|
255
|
+
* @returns The image created.
|
|
256
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
257
|
+
*/
|
|
258
|
+
commit(options?: ContainerCommitOptions): Promise<DockerImage>;
|
|
259
|
+
/**
|
|
260
|
+
* Start an interactive command with a TTY in the running container, as `docker exec -it`. The command runs until it
|
|
261
|
+
* exits (or its stream is closed): see {@link DockerContainerTTY}.
|
|
262
|
+
* @param options The command (`['/bin/sh']` by default; the program and its arguments, run as they are, or a command
|
|
263
|
+
* line, run by `/bin/sh -c`) and the initial console size.
|
|
264
|
+
* @returns The TTY, its command started.
|
|
265
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
266
|
+
* @throws {DockerRequestException} When the container is not running (HTTP 409).
|
|
267
|
+
*/
|
|
268
|
+
createTTY(options?: ContainerCreateTTYOptions): Promise<DockerContainerTTY>;
|
|
269
|
+
/**
|
|
270
|
+
* Read the logs of the container's main process, as `docker logs`: stdout and stderr in one stream, in their order
|
|
271
|
+
* (split from Docker's multiplexed format unless the container has a TTY).
|
|
272
|
+
* @remarks The logs are followed by default: the stream does not end while the container runs. Pass `follow: false`
|
|
273
|
+
* for the logs written so far.
|
|
274
|
+
* @param options `follow` (`true` by default), `since` and `until` (UNIX timestamps in seconds; `0`, no bound, by
|
|
275
|
+
* default), `timestamps` (`false` by default) and `tail` (a number of lines from the end; all by default).
|
|
276
|
+
* @returns The readable stream of the logs.
|
|
277
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
278
|
+
*/
|
|
279
|
+
logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
|
|
280
|
+
/**
|
|
281
|
+
* Read the resource usage of the container once, as `docker stats --no-stream`: CPU, memory, network, block I/O and
|
|
282
|
+
* processes, as the Engine API reports them.
|
|
283
|
+
* @returns The statistics.
|
|
284
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
285
|
+
*/
|
|
286
|
+
stats(): Promise<ContainerStats>;
|
|
287
|
+
/**
|
|
288
|
+
* Run a command in the running container, as `docker exec` (no TTY, no stdin), and wait for it to exit. As the
|
|
289
|
+
* containerd component's, a command exiting with a non-zero code resolves too: check its `exitCode`.
|
|
290
|
+
* @param options The command: a program and its arguments (`['ls', '-l']`), run as they are, or a command line
|
|
291
|
+
* (`'ls /data | wc -l'`), run by `/bin/sh -c`.
|
|
292
|
+
* @returns The exit code of the command, its stdout and its stderr (a program not found: exit code `127` or `126`,
|
|
293
|
+
* the error in the output).
|
|
294
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
295
|
+
* @throws {DockerRequestException} When the container is not running or paused (HTTP 409).
|
|
296
|
+
*/
|
|
297
|
+
exec(options: ContainerExecOptions): Promise<ContainerExecResult>;
|
|
298
|
+
/**
|
|
299
|
+
* Send a signal to the container's main process, as `docker kill` (`SIGKILL` by default), then refresh its properties.
|
|
300
|
+
* @param options The signal sent: a name (`'SIGHUP'`) or a number (`1`); `SIGKILL` by default.
|
|
301
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
302
|
+
* @throws {DockerRequestException} When the container is not running (HTTP 409), or the signal is unknown.
|
|
303
|
+
*/
|
|
304
|
+
kill(options?: ContainerKillOptions): Promise<void>;
|
|
305
|
+
/**
|
|
306
|
+
* Copy a file or a directory out of the container as a tar archive, as `docker cp container:path -`. The container
|
|
307
|
+
* may be stopped.
|
|
308
|
+
* @param options The path in the container, and the `destination` of the archive: a file path (created or
|
|
309
|
+
* overwritten) or a writable stream (ended after the archive).
|
|
310
|
+
* @throws {DockerContainerNotFoundException} When the container was removed.
|
|
311
|
+
* @throws {DockerRequestException} When the path is not found in the container (HTTP 404).
|
|
312
|
+
* @throws {Error} The error of the destination.
|
|
313
|
+
*/
|
|
314
|
+
exportDirectory(options: ContainerExportDirectoryOptions): Promise<void>;
|
|
315
|
+
}
|