@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,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DockerClient = void 0;
|
|
4
|
+
exports.dockerException = dockerException;
|
|
5
|
+
const DockerConnection_js_1 = require("./DockerConnection.js");
|
|
6
|
+
const DockerRequestError_js_1 = require("./DockerRequestError.js");
|
|
7
|
+
const DockerContainerNotFoundException_js_1 = require("../docker/exceptions/DockerContainerNotFoundException.js");
|
|
8
|
+
const DockerImageNotFoundException_js_1 = require("../docker/exceptions/DockerImageNotFoundException.js");
|
|
9
|
+
const DockerNetworkNotFoundException_js_1 = require("../docker/exceptions/DockerNetworkNotFoundException.js");
|
|
10
|
+
const DockerRequestException_js_1 = require("../docker/exceptions/DockerRequestException.js");
|
|
11
|
+
/**
|
|
12
|
+
* The status codes of the requests: the successes, and the reasons of the failures
|
|
13
|
+
*/
|
|
14
|
+
const SERVER_ERROR = { 500: 'server error' };
|
|
15
|
+
const OK = { 200: true, 204: true };
|
|
16
|
+
const NO_SUCH_IMAGE = { 404: 'no such image' };
|
|
17
|
+
const NO_SUCH_CONTAINER = { 404: 'no such container' };
|
|
18
|
+
const NO_SUCH_EXEC = { 404: 'no such exec' };
|
|
19
|
+
const NO_SUCH_NETWORK = { 404: 'no such network' };
|
|
20
|
+
/**
|
|
21
|
+
* The exception of a request the daemon refused: the not found exception of the resource missing (told by the daemon's
|
|
22
|
+
* message, else by the meaning of the status for the request), a DockerRequestException otherwise. The other errors
|
|
23
|
+
* (the network errors, the aborts) are given as they are
|
|
24
|
+
* @param error
|
|
25
|
+
*/
|
|
26
|
+
function dockerException(error) {
|
|
27
|
+
if (!(error instanceof DockerRequestError_js_1.DockerRequestError))
|
|
28
|
+
return error;
|
|
29
|
+
if (error.statusCode === 404) {
|
|
30
|
+
//"No such container: x", "No such image: x", "network x not found" (also in the failure of a start)
|
|
31
|
+
const kind = /no such container/i.test(error.detail) ? 'container'
|
|
32
|
+
: /no such image/i.test(error.detail) ? 'image'
|
|
33
|
+
: /no such network|network \S+ not found/i.test(error.detail) ? 'network'
|
|
34
|
+
: error.reason.replace(/^no such /, '');
|
|
35
|
+
if (kind === 'container')
|
|
36
|
+
return new DockerContainerNotFoundException_js_1.DockerContainerNotFoundException(error.detail);
|
|
37
|
+
if (kind === 'image')
|
|
38
|
+
return new DockerImageNotFoundException_js_1.DockerImageNotFoundException(error.detail);
|
|
39
|
+
if (kind === 'network')
|
|
40
|
+
return new DockerNetworkNotFoundException_js_1.DockerNetworkNotFoundException(error.detail);
|
|
41
|
+
}
|
|
42
|
+
return new DockerRequestException_js_1.DockerRequestException(error.statusCode, error.detail || error.message);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The client of the Docker Engine API
|
|
46
|
+
*/
|
|
47
|
+
class DockerClient {
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
this.connection = new DockerConnection_js_1.DockerConnection(options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A request whose response is JSON, its failure as the exception of the component
|
|
53
|
+
* @param request
|
|
54
|
+
*/
|
|
55
|
+
async #request(request) {
|
|
56
|
+
try {
|
|
57
|
+
return await this.connection.request(request);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw dockerException(e);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A request whose response is a stream, its failure as the exception of the component
|
|
65
|
+
* @param request
|
|
66
|
+
*/
|
|
67
|
+
async #stream(request) {
|
|
68
|
+
try {
|
|
69
|
+
return await this.connection.stream(request);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw dockerException(e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A request upgraded to a raw stream, its failure as the exception of the component
|
|
77
|
+
* @param request
|
|
78
|
+
*/
|
|
79
|
+
async #hijack(request) {
|
|
80
|
+
try {
|
|
81
|
+
return await this.connection.hijack(request);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
throw dockerException(e);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Whether the daemon answers
|
|
89
|
+
* @param signal
|
|
90
|
+
*/
|
|
91
|
+
async ping(signal) {
|
|
92
|
+
return await this.#request({ method: 'GET', path: '/_ping', statusCodes: { 200: true, ...SERVER_ERROR }, signal: signal });
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The versions of the daemon
|
|
96
|
+
*/
|
|
97
|
+
async version() {
|
|
98
|
+
return await this.#request({ method: 'GET', path: '/version', statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check registry credentials (docker login)
|
|
102
|
+
* @param auth
|
|
103
|
+
*/
|
|
104
|
+
async checkAuth(auth) {
|
|
105
|
+
return await this.#request({ method: 'POST', path: '/auth', body: auth, statusCodes: { ...OK, ...SERVER_ERROR } });
|
|
106
|
+
}
|
|
107
|
+
/** Images **/
|
|
108
|
+
async listImages(query, signal) {
|
|
109
|
+
return await this.#request({ method: 'GET', path: '/images/json', query: query, statusCodes: { 200: true, 400: 'bad parameter', ...SERVER_ERROR }, signal: signal });
|
|
110
|
+
}
|
|
111
|
+
async inspectImage(name, signal) {
|
|
112
|
+
return await this.#request({ method: 'GET', path: `/images/${name}/json`, statusCodes: { 200: true, ...NO_SUCH_IMAGE, ...SERVER_ERROR }, signal: signal });
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Pull an image: the stream of the progress (docker pull)
|
|
116
|
+
* @param query fromImage, tag, platform
|
|
117
|
+
* @param auth
|
|
118
|
+
* @param signal
|
|
119
|
+
*/
|
|
120
|
+
async pullImage(query, auth, signal) {
|
|
121
|
+
return await this.#stream({ method: 'POST', path: '/images/create', query: query, auth: auth, statusCodes: { 200: true, ...SERVER_ERROR }, signal: signal });
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build an image: the stream of the progress
|
|
125
|
+
* @param context the gzipped tar archive of the context
|
|
126
|
+
* @param query dockerfile, t, platform, version...
|
|
127
|
+
* @param registryConfig the credentials of the registries, by server
|
|
128
|
+
* @param signal
|
|
129
|
+
*/
|
|
130
|
+
async buildImage(context, query, registryConfig, signal) {
|
|
131
|
+
return await this.#stream({ method: 'POST', path: '/build', query: query, body: context, registryConfig: registryConfig, statusCodes: { 200: true, ...SERVER_ERROR }, signal: signal });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Load the images of a tar archive (docker load): the stream of the progress
|
|
135
|
+
* @param archive
|
|
136
|
+
* @param query quiet
|
|
137
|
+
*/
|
|
138
|
+
async loadImage(archive, query) {
|
|
139
|
+
return await this.#stream({ method: 'POST', path: '/images/load', query: query, body: archive, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The tar archive of an image (docker save)
|
|
143
|
+
* @param name
|
|
144
|
+
*/
|
|
145
|
+
async exportImage(name) {
|
|
146
|
+
return await this.#stream({ method: 'GET', path: `/images/${name}/get`, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
147
|
+
}
|
|
148
|
+
async tagImage(name, query) {
|
|
149
|
+
await this.#request({ method: 'POST', path: `/images/${name}/tag`, query: query, statusCodes: { 200: true, 201: true, 400: 'bad parameter', ...NO_SUCH_IMAGE, 409: 'conflict', ...SERVER_ERROR } });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Push an image: the stream of the progress
|
|
153
|
+
* @param name
|
|
154
|
+
* @param query tag, platform
|
|
155
|
+
* @param auth
|
|
156
|
+
*/
|
|
157
|
+
async pushImage(name, query, auth) {
|
|
158
|
+
return await this.#stream({ method: 'POST', path: `/images/${name}/push`, query: query, auth: (auth ?? {}), statusCodes: { 200: true, ...NO_SUCH_IMAGE, ...SERVER_ERROR } });
|
|
159
|
+
}
|
|
160
|
+
async removeImage(name, query) {
|
|
161
|
+
return await this.#request({ method: 'DELETE', path: `/images/${name}`, query: query, statusCodes: { 200: true, ...NO_SUCH_IMAGE, 409: 'conflict', ...SERVER_ERROR } });
|
|
162
|
+
}
|
|
163
|
+
async pruneImages(query) {
|
|
164
|
+
return await this.#request({ method: 'POST', path: '/images/prune', query: query, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
165
|
+
}
|
|
166
|
+
/** Containers **/
|
|
167
|
+
async listContainers(query, signal) {
|
|
168
|
+
return await this.#request({ method: 'GET', path: '/containers/json', query: query, statusCodes: { 200: true, 400: 'bad parameter', ...SERVER_ERROR }, signal: signal });
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a container
|
|
172
|
+
* @param body its configuration
|
|
173
|
+
* @param query name, platform
|
|
174
|
+
*/
|
|
175
|
+
async createContainer(body, query) {
|
|
176
|
+
return await this.#request({ method: 'POST', path: '/containers/create', query: query, body: body, statusCodes: { 200: true, 201: true, 400: 'bad parameter', ...NO_SUCH_IMAGE, 409: 'conflict', ...SERVER_ERROR } });
|
|
177
|
+
}
|
|
178
|
+
async inspectContainer(id, signal) {
|
|
179
|
+
return await this.#request({ method: 'GET', path: `/containers/${id}/json`, statusCodes: { 200: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR }, signal: signal });
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Start a container: one already started is done (HTTP 304), as the Docker CLI does
|
|
183
|
+
* @param id
|
|
184
|
+
* @param signal
|
|
185
|
+
*/
|
|
186
|
+
async startContainer(id, signal) {
|
|
187
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/start`, statusCodes: { ...OK, 304: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR }, signal: signal });
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Stop a container: one already stopped is done (HTTP 304), as the Docker CLI does
|
|
191
|
+
* @param id
|
|
192
|
+
* @param query
|
|
193
|
+
* @param signal
|
|
194
|
+
*/
|
|
195
|
+
async stopContainer(id, query, signal) {
|
|
196
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/stop`, query: query, statusCodes: { ...OK, 304: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR }, signal: signal });
|
|
197
|
+
}
|
|
198
|
+
async restartContainer(id, query, signal) {
|
|
199
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/restart`, query: query, statusCodes: { ...OK, ...NO_SUCH_CONTAINER, ...SERVER_ERROR }, signal: signal });
|
|
200
|
+
}
|
|
201
|
+
async pauseContainer(id) {
|
|
202
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/pause`, statusCodes: { ...OK, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
203
|
+
}
|
|
204
|
+
async unpauseContainer(id) {
|
|
205
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/unpause`, statusCodes: { ...OK, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
206
|
+
}
|
|
207
|
+
async killContainer(id, query) {
|
|
208
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/kill`, query: query, statusCodes: { ...OK, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
209
|
+
}
|
|
210
|
+
async removeContainer(id, query) {
|
|
211
|
+
await this.#request({ method: 'DELETE', path: `/containers/${id}`, query: query, statusCodes: { ...OK, 400: 'bad parameter', ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Rename a container
|
|
215
|
+
* @param id
|
|
216
|
+
* @param name
|
|
217
|
+
*/
|
|
218
|
+
async renameContainer(id, name) {
|
|
219
|
+
await this.#request({ method: 'POST', path: `/containers/${id}/rename`, query: { name: name }, statusCodes: { ...OK, ...NO_SUCH_CONTAINER, 409: 'name already in use', ...SERVER_ERROR } });
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Update the resources and the restart policy of a container, live (docker update)
|
|
223
|
+
* @param id
|
|
224
|
+
* @param body
|
|
225
|
+
*/
|
|
226
|
+
async updateContainer(id, body) {
|
|
227
|
+
return await this.#request({ method: 'POST', path: `/containers/${id}/update`, body: body, statusCodes: { ...OK, 400: 'bad parameter', ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Create an image of a container (docker commit)
|
|
231
|
+
* @param id
|
|
232
|
+
* @param query repo, tag, comment, author, pause, changes
|
|
233
|
+
*/
|
|
234
|
+
async commitContainer(id, query) {
|
|
235
|
+
return await this.#request({ method: 'POST', path: '/commit', query: { ...query, container: id }, statusCodes: { 200: true, 201: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The logs of a container: multiplexed when it has no TTY
|
|
239
|
+
* @param id
|
|
240
|
+
* @param query follow, stdout, stderr, since, until, timestamps, tail
|
|
241
|
+
*/
|
|
242
|
+
async containerLogs(id, query) {
|
|
243
|
+
return await this.#stream({ method: 'GET', path: `/containers/${id}/logs`, query: query, statusCodes: { 200: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The statistics of a container, once
|
|
247
|
+
* @param id
|
|
248
|
+
*/
|
|
249
|
+
async containerStats(id) {
|
|
250
|
+
return await this.#request({ method: 'GET', path: `/containers/${id}/stats`, query: { 'stream': false, 'one-shot': true }, statusCodes: { 200: true, ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The tar archive of a path of a container
|
|
254
|
+
* @param id
|
|
255
|
+
* @param query path
|
|
256
|
+
*/
|
|
257
|
+
async getArchive(id, query) {
|
|
258
|
+
return await this.#stream({ method: 'GET', path: `/containers/${id}/archive`, query: query, statusCodes: { 200: true, 400: 'client error, bad parameters', ...NO_SUCH_CONTAINER, ...SERVER_ERROR } });
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Create an execution in a container
|
|
262
|
+
* @param id
|
|
263
|
+
* @param body Cmd, AttachStdin, AttachStdout, AttachStderr, Tty, ConsoleSize...
|
|
264
|
+
*/
|
|
265
|
+
async createExec(id, body) {
|
|
266
|
+
return await this.#request({ method: 'POST', path: `/containers/${id}/exec`, body: body, statusCodes: { 200: true, 201: true, ...NO_SUCH_CONTAINER, 409: 'container stopped/paused', ...SERVER_ERROR } });
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Start an execution, attached: its stream, read (its output, multiplexed without TTY) and written (its input)
|
|
270
|
+
* @param execId
|
|
271
|
+
* @param body Detach, Tty
|
|
272
|
+
*/
|
|
273
|
+
async startExec(execId, body) {
|
|
274
|
+
return await this.#hijack({ method: 'POST', path: `/exec/${execId}/start`, body: body, statusCodes: { ...OK, ...NO_SUCH_EXEC, 409: 'container stopped/paused', 500: 'container not running' } });
|
|
275
|
+
}
|
|
276
|
+
async resizeExec(execId, query) {
|
|
277
|
+
await this.#request({ method: 'POST', path: `/exec/${execId}/resize`, query: query, statusCodes: { ...OK, ...NO_SUCH_EXEC, 500: 'container not running' } });
|
|
278
|
+
}
|
|
279
|
+
async inspectExec(execId) {
|
|
280
|
+
return await this.#request({ method: 'GET', path: `/exec/${execId}/json`, statusCodes: { 200: true, ...NO_SUCH_EXEC, ...SERVER_ERROR } });
|
|
281
|
+
}
|
|
282
|
+
async pruneContainers(query) {
|
|
283
|
+
return await this.#request({ method: 'POST', path: '/containers/prune', query: query, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
284
|
+
}
|
|
285
|
+
/** Networks **/
|
|
286
|
+
async listNetworks(query, signal) {
|
|
287
|
+
return await this.#request({ method: 'GET', path: '/networks', query: query, statusCodes: { 200: true, 400: 'bad parameter', ...SERVER_ERROR }, signal: signal });
|
|
288
|
+
}
|
|
289
|
+
async createNetwork(body) {
|
|
290
|
+
return await this.#request({ method: 'POST', path: '/networks/create', body: body, statusCodes: { 200: true, 201: true, 404: 'driver not found', ...SERVER_ERROR } });
|
|
291
|
+
}
|
|
292
|
+
async inspectNetwork(id) {
|
|
293
|
+
return await this.#request({ method: 'GET', path: `/networks/${id}`, statusCodes: { 200: true, ...NO_SUCH_NETWORK, ...SERVER_ERROR } });
|
|
294
|
+
}
|
|
295
|
+
async removeNetwork(id) {
|
|
296
|
+
await this.#request({ method: 'DELETE', path: `/networks/${id}`, statusCodes: { ...OK, ...NO_SUCH_NETWORK, 409: 'conflict', ...SERVER_ERROR } });
|
|
297
|
+
}
|
|
298
|
+
async pruneNetworks(query) {
|
|
299
|
+
return await this.#request({ method: 'POST', path: '/networks/prune', query: query, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
300
|
+
}
|
|
301
|
+
/** Volumes **/
|
|
302
|
+
async pruneVolumes(query) {
|
|
303
|
+
return await this.#request({ method: 'POST', path: '/volumes/prune', query: query, statusCodes: { 200: true, ...SERVER_ERROR } });
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Close the connections kept alive
|
|
307
|
+
*/
|
|
308
|
+
close() {
|
|
309
|
+
this.connection.close();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
exports.DockerClient = DockerClient;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type Agent, type ClientRequest, type IncomingMessage, type RequestOptions } from 'node:http';
|
|
2
|
+
import { Duplex } from 'node:stream';
|
|
3
|
+
import { DockerRequestError } from './DockerRequestError.js';
|
|
4
|
+
/**
|
|
5
|
+
* A key of a TLS connection with its passphrase
|
|
6
|
+
*/
|
|
7
|
+
export type DockerKeyObject = {
|
|
8
|
+
pem: string | Buffer;
|
|
9
|
+
passphrase?: string;
|
|
10
|
+
};
|
|
11
|
+
export type DockerConnectionOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* The socket of the Docker daemon (a Unix socket, or a named pipe on Windows)
|
|
14
|
+
*/
|
|
15
|
+
socketPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The host of the Docker daemon (tcp, https, ssh)
|
|
18
|
+
*/
|
|
19
|
+
host?: string;
|
|
20
|
+
port?: number | string;
|
|
21
|
+
protocol?: 'http' | 'https' | 'ssh';
|
|
22
|
+
/**
|
|
23
|
+
* The user of the SSH connection
|
|
24
|
+
*/
|
|
25
|
+
username?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The SSH agent socket, the one of SSH_AUTH_SOCK by default
|
|
29
|
+
*/
|
|
30
|
+
sshAuthAgent?: string;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
ca?: string | string[] | Buffer | Buffer[];
|
|
33
|
+
cert?: string | string[] | Buffer | Buffer[];
|
|
34
|
+
key?: string | string[] | Buffer | Buffer[] | DockerKeyObject[];
|
|
35
|
+
/**
|
|
36
|
+
* The timeout of the requests, in milliseconds
|
|
37
|
+
*/
|
|
38
|
+
timeout?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The API version ("1.47", or "v1.47"), negotiated with the daemon by default
|
|
41
|
+
*/
|
|
42
|
+
version?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A request to the Engine API
|
|
46
|
+
*/
|
|
47
|
+
export type DockerRequest = {
|
|
48
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD';
|
|
49
|
+
path: string;
|
|
50
|
+
/**
|
|
51
|
+
* The query parameters: the objects are JSON encoded, the arrays repeat their parameter, the undefined ones are omitted
|
|
52
|
+
*/
|
|
53
|
+
query?: Record<string, unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* A JSON body, or a stream sent as it is (a tar archive)
|
|
56
|
+
*/
|
|
57
|
+
body?: unknown;
|
|
58
|
+
headers?: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* The registry credentials of the request (X-Registry-Auth)
|
|
61
|
+
*/
|
|
62
|
+
auth?: Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* The registry credentials of a build (X-Registry-Config)
|
|
65
|
+
*/
|
|
66
|
+
registryConfig?: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* The meanings of the status codes: true for a success, the reason of the failure otherwise
|
|
69
|
+
*/
|
|
70
|
+
statusCodes: Record<number, true | string>;
|
|
71
|
+
signal?: AbortSignal;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* The newest API version this client is tested with (Docker 29.8): the one negotiated when the daemon supports it, so that
|
|
75
|
+
* a newer daemon answers as the tested one. An older daemon answers with its version: the fields a version does not have
|
|
76
|
+
* are missing or null
|
|
77
|
+
*/
|
|
78
|
+
export declare const DOCKER_API_VERSION: string;
|
|
79
|
+
/**
|
|
80
|
+
* The oldest API version this client works with
|
|
81
|
+
*/
|
|
82
|
+
export declare const DOCKER_MIN_API_VERSION: string;
|
|
83
|
+
/**
|
|
84
|
+
* Compare two API versions
|
|
85
|
+
* @param a
|
|
86
|
+
* @param b
|
|
87
|
+
*/
|
|
88
|
+
export declare function compareAPIVersions(a: string, b: string): number;
|
|
89
|
+
/**
|
|
90
|
+
* The connection options given by the environment (DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH,
|
|
91
|
+
* DOCKER_CLIENT_TIMEOUT), else the socket of the platform: the named pipe on Windows, the socket of the user (Docker
|
|
92
|
+
* Desktop) or /var/run/docker.sock
|
|
93
|
+
*/
|
|
94
|
+
export declare function defaultConnectionOptions(): DockerConnectionOptions;
|
|
95
|
+
/**
|
|
96
|
+
* The connection to a Docker daemon
|
|
97
|
+
*/
|
|
98
|
+
export declare class DockerConnection {
|
|
99
|
+
#private;
|
|
100
|
+
constructor(options?: DockerConnectionOptions);
|
|
101
|
+
/**
|
|
102
|
+
* The API version of the requests, once negotiated
|
|
103
|
+
*/
|
|
104
|
+
get version(): string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Negotiate the API version with the daemon: the newest one both support
|
|
107
|
+
*/
|
|
108
|
+
negotiate(): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* The agent of an SSH connection: the requests are sent to "docker system dial-stdio" (ssh2, an optional dependency)
|
|
111
|
+
*/
|
|
112
|
+
protected sshAgent(): Promise<Agent>;
|
|
113
|
+
/**
|
|
114
|
+
* The options of a request
|
|
115
|
+
* @param request
|
|
116
|
+
* @param streamingBody
|
|
117
|
+
*/
|
|
118
|
+
protected requestOptions(request: DockerRequest, streamingBody: boolean): Promise<RequestOptions>;
|
|
119
|
+
/**
|
|
120
|
+
* Send a request: the response, once its status is known
|
|
121
|
+
* @param request
|
|
122
|
+
* @param hijack upgrade the connection to a raw stream (the TTYs, the attached executions)
|
|
123
|
+
*/
|
|
124
|
+
protected send(request: DockerRequest, hijack?: boolean): Promise<{
|
|
125
|
+
response?: IncomingMessage;
|
|
126
|
+
socket?: Duplex;
|
|
127
|
+
request: ClientRequest;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* The error of a failed response
|
|
131
|
+
* @param request
|
|
132
|
+
* @param response
|
|
133
|
+
*/
|
|
134
|
+
protected failure(request: DockerRequest, response: IncomingMessage): Promise<DockerRequestError>;
|
|
135
|
+
/**
|
|
136
|
+
* A request whose response is JSON (or nothing)
|
|
137
|
+
* @param request
|
|
138
|
+
*/
|
|
139
|
+
request<T = any>(request: DockerRequest): Promise<T>;
|
|
140
|
+
/**
|
|
141
|
+
* A request whose response is a stream (the progress of a pull, the logs, an archive)
|
|
142
|
+
* @param request
|
|
143
|
+
*/
|
|
144
|
+
stream(request: DockerRequest): Promise<IncomingMessage>;
|
|
145
|
+
/**
|
|
146
|
+
* A request upgraded to a raw stream, read and written (the TTYs, the attached executions)
|
|
147
|
+
* @param request
|
|
148
|
+
*/
|
|
149
|
+
hijack(request: DockerRequest): Promise<Duplex>;
|
|
150
|
+
/**
|
|
151
|
+
* Close the kept alive connections
|
|
152
|
+
*/
|
|
153
|
+
close(): void;
|
|
154
|
+
}
|