@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,35 @@
|
|
|
1
|
+
import { Transform, type TransformCallback } from 'node:stream';
|
|
2
|
+
/**
|
|
3
|
+
* The stream of a frame of a multiplexed output
|
|
4
|
+
*/
|
|
5
|
+
export declare enum DockerStreamType {
|
|
6
|
+
STDIN = 0,
|
|
7
|
+
STDOUT = 1,
|
|
8
|
+
STDERR = 2
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The output of a container without TTY is multiplexed: each frame is a header of 8 bytes (the stream, 3 zeros, the
|
|
12
|
+
* size as a big endian uint32) and its content. The decoder gives the contents, in their order; its "frame" event
|
|
13
|
+
* gives each content with its stream
|
|
14
|
+
*/
|
|
15
|
+
export declare class DockerStreamDecoder extends Transform {
|
|
16
|
+
#private;
|
|
17
|
+
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
18
|
+
_flush(callback: TransformCallback): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The output of a multiplexed stream (or buffer), and its outputs by stream
|
|
22
|
+
* @param input
|
|
23
|
+
*/
|
|
24
|
+
export declare function readMultiplexed(input: NodeJS.ReadableStream | Buffer): Promise<{
|
|
25
|
+
output: string;
|
|
26
|
+
stdout: string;
|
|
27
|
+
stderr: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Read the JSON lines of a progress (a pull, a push, a build, a load): each object is given to the callback, all of them
|
|
31
|
+
* are given back once the stream ends. The lines which are not JSON are skipped
|
|
32
|
+
* @param input
|
|
33
|
+
* @param onProgress
|
|
34
|
+
*/
|
|
35
|
+
export declare function followProgress<T = Record<string, any>>(input: NodeJS.ReadableStream, onProgress?: (progress: T) => void): Promise<T[]>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DockerStreamDecoder = exports.DockerStreamType = void 0;
|
|
4
|
+
exports.readMultiplexed = readMultiplexed;
|
|
5
|
+
exports.followProgress = followProgress;
|
|
6
|
+
/*
|
|
7
|
+
* The streams of the Docker Engine API, rewritten from docker-modem (Copyright Pedro Dias, Apache License 2.0, see
|
|
8
|
+
* THIRD_PARTY_NOTICES.md): the multiplexed output of the containers without TTY, and the JSON lines of the progresses
|
|
9
|
+
*/
|
|
10
|
+
const node_stream_1 = require("node:stream");
|
|
11
|
+
/**
|
|
12
|
+
* The stream of a frame of a multiplexed output
|
|
13
|
+
*/
|
|
14
|
+
var DockerStreamType;
|
|
15
|
+
(function (DockerStreamType) {
|
|
16
|
+
DockerStreamType[DockerStreamType["STDIN"] = 0] = "STDIN";
|
|
17
|
+
DockerStreamType[DockerStreamType["STDOUT"] = 1] = "STDOUT";
|
|
18
|
+
DockerStreamType[DockerStreamType["STDERR"] = 2] = "STDERR";
|
|
19
|
+
})(DockerStreamType || (exports.DockerStreamType = DockerStreamType = {}));
|
|
20
|
+
/**
|
|
21
|
+
* The output of a container without TTY is multiplexed: each frame is a header of 8 bytes (the stream, 3 zeros, the
|
|
22
|
+
* size as a big endian uint32) and its content. The decoder gives the contents, in their order; its "frame" event
|
|
23
|
+
* gives each content with its stream
|
|
24
|
+
*/
|
|
25
|
+
class DockerStreamDecoder extends node_stream_1.Transform {
|
|
26
|
+
#pending = Buffer.alloc(0);
|
|
27
|
+
_transform(chunk, _encoding, callback) {
|
|
28
|
+
this.#pending = this.#pending.length ? Buffer.concat([this.#pending, chunk]) : chunk;
|
|
29
|
+
while (this.#pending.length >= 8) {
|
|
30
|
+
const size = this.#pending.readUInt32BE(4);
|
|
31
|
+
if (this.#pending.length < 8 + size)
|
|
32
|
+
break;
|
|
33
|
+
const type = this.#pending.readUInt8(0);
|
|
34
|
+
const content = this.#pending.subarray(8, 8 + size);
|
|
35
|
+
this.#pending = this.#pending.subarray(8 + size);
|
|
36
|
+
if (content.length) {
|
|
37
|
+
this.emit('frame', type, content);
|
|
38
|
+
this.push(content);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
callback();
|
|
42
|
+
}
|
|
43
|
+
_flush(callback) {
|
|
44
|
+
//A truncated frame is given as it is
|
|
45
|
+
if (this.#pending.length)
|
|
46
|
+
this.push(this.#pending);
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.DockerStreamDecoder = DockerStreamDecoder;
|
|
51
|
+
/**
|
|
52
|
+
* The output of a multiplexed stream (or buffer), and its outputs by stream
|
|
53
|
+
* @param input
|
|
54
|
+
*/
|
|
55
|
+
async function readMultiplexed(input) {
|
|
56
|
+
const decoder = new DockerStreamDecoder();
|
|
57
|
+
const output = [];
|
|
58
|
+
const streams = { [DockerStreamType.STDOUT]: [], [DockerStreamType.STDERR]: [] };
|
|
59
|
+
decoder.on('frame', (type, content) => (streams[type] ??= []).push(content));
|
|
60
|
+
decoder.on('data', (content) => output.push(content));
|
|
61
|
+
await new Promise((resolve, reject) => {
|
|
62
|
+
decoder.once('end', resolve).once('error', reject);
|
|
63
|
+
if (Buffer.isBuffer(input)) {
|
|
64
|
+
decoder.end(input);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
input.once('error', (error) => decoder.destroy(error));
|
|
68
|
+
input.pipe(decoder);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
output: Buffer.concat(output).toString(),
|
|
73
|
+
stdout: Buffer.concat(streams[DockerStreamType.STDOUT]).toString(),
|
|
74
|
+
stderr: Buffer.concat(streams[DockerStreamType.STDERR]).toString()
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read the JSON lines of a progress (a pull, a push, a build, a load): each object is given to the callback, all of them
|
|
79
|
+
* are given back once the stream ends. The lines which are not JSON are skipped
|
|
80
|
+
* @param input
|
|
81
|
+
* @param onProgress
|
|
82
|
+
*/
|
|
83
|
+
async function followProgress(input, onProgress) {
|
|
84
|
+
const objects = [];
|
|
85
|
+
let pending = '';
|
|
86
|
+
const line = (text) => {
|
|
87
|
+
const trimmed = text.trim();
|
|
88
|
+
if (!trimmed)
|
|
89
|
+
return;
|
|
90
|
+
let object;
|
|
91
|
+
try {
|
|
92
|
+
object = JSON.parse(trimmed);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
objects.push(object);
|
|
98
|
+
onProgress?.(object);
|
|
99
|
+
};
|
|
100
|
+
await new Promise((resolve, reject) => {
|
|
101
|
+
input.on('data', (chunk) => {
|
|
102
|
+
pending += chunk.toString();
|
|
103
|
+
let position;
|
|
104
|
+
while ((position = pending.indexOf('\n')) >= 0) {
|
|
105
|
+
line(pending.slice(0, position));
|
|
106
|
+
pending = pending.slice(position + 1);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
input.once('end', () => {
|
|
110
|
+
line(pending);
|
|
111
|
+
resolve();
|
|
112
|
+
});
|
|
113
|
+
input.once('close', resolve);
|
|
114
|
+
input.once('error', reject);
|
|
115
|
+
});
|
|
116
|
+
return objects;
|
|
117
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The query of stopping or restarting a container in the Docker Engine API
|
|
3
|
+
*/
|
|
4
|
+
export type ContainerStopQuery = {
|
|
5
|
+
/**
|
|
6
|
+
* The number of seconds to wait before killing the container
|
|
7
|
+
*/
|
|
8
|
+
t?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The signal to send to the container
|
|
11
|
+
*/
|
|
12
|
+
signal?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { IDockerConnectionOptions } from './interfaces/IDockerConnectionOptions.js';
|
|
2
|
+
import { IDockerHttpConnectionOptions } from './interfaces/IDockerHttpConnectionOptions.js';
|
|
3
|
+
import { IDockerHttpsConnectionOptions } from './interfaces/IDockerHttpsConnectionOptions.js';
|
|
4
|
+
import { IDockerSSHConnectionOptions } from './interfaces/IDockerSSHConnectionOptions.js';
|
|
5
|
+
import { ComponentOptionsBuilder } from '@lakutata/core';
|
|
6
|
+
/**
|
|
7
|
+
* Build the component options of a {@link Docker} connected as the options say, to register it in the `components` of
|
|
8
|
+
* an application under the name of your choice. Without `socketPath` nor `host`, it connects to the Docker of the
|
|
9
|
+
* environment (`DOCKER_HOST`, else the local socket). The options are validated when the component is created, not
|
|
10
|
+
* here.
|
|
11
|
+
* @param options The connection options: a socket (`socketPath`), or a `host` and `port` reached with `protocol`
|
|
12
|
+
* (`'http'`, `'https'` or `'ssh'`), with their TLS, SSH, timeout and API version options.
|
|
13
|
+
* @returns The component options (`{class: Docker, ...options}`).
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import {Application} from 'lakutata'
|
|
17
|
+
* import {buildDockerConnectionOptions} from 'lakutata/com/docker'
|
|
18
|
+
*
|
|
19
|
+
* Application.run(() => ({
|
|
20
|
+
* id: 'docker.app',
|
|
21
|
+
* name: 'Docker',
|
|
22
|
+
* components: {
|
|
23
|
+
* //The Docker of the environment (DOCKER_HOST, else the local socket), with the API version 1.47
|
|
24
|
+
* docker: buildDockerConnectionOptions({version: '1.47'})
|
|
25
|
+
* }
|
|
26
|
+
* }))
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const buildDockerConnectionOptions: ComponentOptionsBuilder<IDockerConnectionOptions>;
|
|
30
|
+
/**
|
|
31
|
+
* Build the component options of a {@link Docker} connected to the Unix socket of a daemon (or its named pipe on
|
|
32
|
+
* Windows), to register it in the `components` of an application. The options are validated when the component is
|
|
33
|
+
* created, not here.
|
|
34
|
+
* @param options The path of the socket (`socketPath`), with the timeout and the API version. Without `socketPath`, the
|
|
35
|
+
* Docker of the environment is used, with the other options applied over it.
|
|
36
|
+
* @returns The component options (`{class: Docker, ...options}`).
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import {Application} from 'lakutata'
|
|
40
|
+
* import {buildDockerSocketConnectionOptions} from 'lakutata/com/docker'
|
|
41
|
+
*
|
|
42
|
+
* Application.run(() => ({
|
|
43
|
+
* id: 'docker.app',
|
|
44
|
+
* name: 'Docker',
|
|
45
|
+
* components: {
|
|
46
|
+
* docker: buildDockerSocketConnectionOptions({socketPath: '/var/run/docker.sock', timeout: 60000})
|
|
47
|
+
* }
|
|
48
|
+
* }))
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const buildDockerSocketConnectionOptions: ComponentOptionsBuilder<IDockerConnectionOptions>;
|
|
52
|
+
/**
|
|
53
|
+
* Build the component options of a {@link Docker} connected to a daemon over plain HTTP (`dockerd -H tcp://0.0.0.0:2375`),
|
|
54
|
+
* to register it in the `components` of an application. The connection is neither encrypted nor authenticated: keep it
|
|
55
|
+
* to trusted networks. The options are validated when the component is created, not here.
|
|
56
|
+
* @param options The `host` and `port` of the daemon, with the headers, the timeout and the API version; the `protocol`
|
|
57
|
+
* is set to `'http'`.
|
|
58
|
+
* @returns The component options (`{class: Docker, protocol: 'http', ...options}`).
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* import {Application} from 'lakutata'
|
|
62
|
+
* import {buildDockerHttpConnectionOptions} from 'lakutata/com/docker'
|
|
63
|
+
*
|
|
64
|
+
* Application.run(() => ({
|
|
65
|
+
* id: 'docker.app',
|
|
66
|
+
* name: 'Docker',
|
|
67
|
+
* components: {
|
|
68
|
+
* docker: buildDockerHttpConnectionOptions({host: '192.168.1.10', port: 2375})
|
|
69
|
+
* }
|
|
70
|
+
* }))
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const buildDockerHttpConnectionOptions: ComponentOptionsBuilder<IDockerHttpConnectionOptions>;
|
|
74
|
+
/**
|
|
75
|
+
* Build the component options of a {@link Docker} connected to a daemon over HTTPS (`dockerd --tlsverify -H
|
|
76
|
+
* tcp://0.0.0.0:2376`), to register it in the `components` of an application. The options are validated when the
|
|
77
|
+
* component is created, not here.
|
|
78
|
+
* @param options The `host` and `port` of the daemon, with the PEM contents of the authority (`ca`), the client
|
|
79
|
+
* certificate (`cert`) and its key (`key`), the headers, the timeout and the API version; the `protocol` is set to
|
|
80
|
+
* `'https'`.
|
|
81
|
+
* @returns The component options (`{class: Docker, protocol: 'https', ...options}`).
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* import {readFileSync} from 'node:fs'
|
|
85
|
+
* import {Application} from 'lakutata'
|
|
86
|
+
* import {buildDockerHttpsConnectionOptions} from 'lakutata/com/docker'
|
|
87
|
+
*
|
|
88
|
+
* Application.run(() => ({
|
|
89
|
+
* id: 'docker.app',
|
|
90
|
+
* name: 'Docker',
|
|
91
|
+
* components: {
|
|
92
|
+
* //The PEM contents, not the file paths
|
|
93
|
+
* docker: buildDockerHttpsConnectionOptions({
|
|
94
|
+
* host: 'docker.example.com',
|
|
95
|
+
* port: 2376,
|
|
96
|
+
* ca: readFileSync('/etc/docker/certs/ca.pem'),
|
|
97
|
+
* cert: readFileSync('/etc/docker/certs/cert.pem'),
|
|
98
|
+
* key: readFileSync('/etc/docker/certs/key.pem')
|
|
99
|
+
* })
|
|
100
|
+
* }
|
|
101
|
+
* }))
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare const buildDockerHttpsConnectionOptions: ComponentOptionsBuilder<IDockerHttpsConnectionOptions>;
|
|
105
|
+
/**
|
|
106
|
+
* Build the component options of a {@link Docker} connected to a remote daemon over SSH, as `DOCKER_HOST=ssh://user@host`
|
|
107
|
+
* does, to register it in the `components` of an application. The requests go through `docker system dial-stdio` run on
|
|
108
|
+
* the remote host, which needs the Docker CLI; locally, the optional package `ssh2` must be installed. The SSH connection
|
|
109
|
+
* authenticates through the SSH agent (no password). The options are validated when the component is created, not here.
|
|
110
|
+
* @param options The `host` and `port` (the SSH port, usually 22) of the remote host, the `username`, the SSH agent's
|
|
111
|
+
* socket (`sshAuthAgent`; `SSH_AUTH_SOCK` by default), the timeout and the API version; the `protocol` is set to
|
|
112
|
+
* `'ssh'`.
|
|
113
|
+
* @returns The component options (`{class: Docker, protocol: 'ssh', ...options}`).
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* import {Application} from 'lakutata'
|
|
117
|
+
* import {buildDockerSSHConnectionOptions} from 'lakutata/com/docker'
|
|
118
|
+
*
|
|
119
|
+
* Application.run(() => ({
|
|
120
|
+
* id: 'docker.app',
|
|
121
|
+
* name: 'Docker',
|
|
122
|
+
* components: {
|
|
123
|
+
* docker: buildDockerSSHConnectionOptions({host: 'docker.example.com', port: 22, username: 'deploy'})
|
|
124
|
+
* }
|
|
125
|
+
* }))
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare const buildDockerSSHConnectionOptions: ComponentOptionsBuilder<IDockerSSHConnectionOptions>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDockerSSHConnectionOptions = exports.buildDockerHttpsConnectionOptions = exports.buildDockerHttpConnectionOptions = exports.buildDockerSocketConnectionOptions = exports.buildDockerConnectionOptions = void 0;
|
|
4
|
+
const Docker_js_1 = require("./Docker.js");
|
|
5
|
+
/**
|
|
6
|
+
* Build the component options of a {@link Docker} connected as the options say, to register it in the `components` of
|
|
7
|
+
* an application under the name of your choice. Without `socketPath` nor `host`, it connects to the Docker of the
|
|
8
|
+
* environment (`DOCKER_HOST`, else the local socket). The options are validated when the component is created, not
|
|
9
|
+
* here.
|
|
10
|
+
* @param options The connection options: a socket (`socketPath`), or a `host` and `port` reached with `protocol`
|
|
11
|
+
* (`'http'`, `'https'` or `'ssh'`), with their TLS, SSH, timeout and API version options.
|
|
12
|
+
* @returns The component options (`{class: Docker, ...options}`).
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import {Application} from 'lakutata'
|
|
16
|
+
* import {buildDockerConnectionOptions} from 'lakutata/com/docker'
|
|
17
|
+
*
|
|
18
|
+
* Application.run(() => ({
|
|
19
|
+
* id: 'docker.app',
|
|
20
|
+
* name: 'Docker',
|
|
21
|
+
* components: {
|
|
22
|
+
* //The Docker of the environment (DOCKER_HOST, else the local socket), with the API version 1.47
|
|
23
|
+
* docker: buildDockerConnectionOptions({version: '1.47'})
|
|
24
|
+
* }
|
|
25
|
+
* }))
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
const buildDockerConnectionOptions = (options) => ({
|
|
29
|
+
...options,
|
|
30
|
+
class: Docker_js_1.Docker
|
|
31
|
+
});
|
|
32
|
+
exports.buildDockerConnectionOptions = buildDockerConnectionOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Build the component options of a {@link Docker} connected to the Unix socket of a daemon (or its named pipe on
|
|
35
|
+
* Windows), to register it in the `components` of an application. The options are validated when the component is
|
|
36
|
+
* created, not here.
|
|
37
|
+
* @param options The path of the socket (`socketPath`), with the timeout and the API version. Without `socketPath`, the
|
|
38
|
+
* Docker of the environment is used, with the other options applied over it.
|
|
39
|
+
* @returns The component options (`{class: Docker, ...options}`).
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import {Application} from 'lakutata'
|
|
43
|
+
* import {buildDockerSocketConnectionOptions} from 'lakutata/com/docker'
|
|
44
|
+
*
|
|
45
|
+
* Application.run(() => ({
|
|
46
|
+
* id: 'docker.app',
|
|
47
|
+
* name: 'Docker',
|
|
48
|
+
* components: {
|
|
49
|
+
* docker: buildDockerSocketConnectionOptions({socketPath: '/var/run/docker.sock', timeout: 60000})
|
|
50
|
+
* }
|
|
51
|
+
* }))
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
const buildDockerSocketConnectionOptions = (options) => ({
|
|
55
|
+
...options,
|
|
56
|
+
class: Docker_js_1.Docker
|
|
57
|
+
});
|
|
58
|
+
exports.buildDockerSocketConnectionOptions = buildDockerSocketConnectionOptions;
|
|
59
|
+
/**
|
|
60
|
+
* Build the component options of a {@link Docker} connected to a daemon over plain HTTP (`dockerd -H tcp://0.0.0.0:2375`),
|
|
61
|
+
* to register it in the `components` of an application. The connection is neither encrypted nor authenticated: keep it
|
|
62
|
+
* to trusted networks. The options are validated when the component is created, not here.
|
|
63
|
+
* @param options The `host` and `port` of the daemon, with the headers, the timeout and the API version; the `protocol`
|
|
64
|
+
* is set to `'http'`.
|
|
65
|
+
* @returns The component options (`{class: Docker, protocol: 'http', ...options}`).
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* import {Application} from 'lakutata'
|
|
69
|
+
* import {buildDockerHttpConnectionOptions} from 'lakutata/com/docker'
|
|
70
|
+
*
|
|
71
|
+
* Application.run(() => ({
|
|
72
|
+
* id: 'docker.app',
|
|
73
|
+
* name: 'Docker',
|
|
74
|
+
* components: {
|
|
75
|
+
* docker: buildDockerHttpConnectionOptions({host: '192.168.1.10', port: 2375})
|
|
76
|
+
* }
|
|
77
|
+
* }))
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
const buildDockerHttpConnectionOptions = (options) => ({
|
|
81
|
+
...options,
|
|
82
|
+
protocol: 'http',
|
|
83
|
+
class: Docker_js_1.Docker
|
|
84
|
+
});
|
|
85
|
+
exports.buildDockerHttpConnectionOptions = buildDockerHttpConnectionOptions;
|
|
86
|
+
/**
|
|
87
|
+
* Build the component options of a {@link Docker} connected to a daemon over HTTPS (`dockerd --tlsverify -H
|
|
88
|
+
* tcp://0.0.0.0:2376`), to register it in the `components` of an application. The options are validated when the
|
|
89
|
+
* component is created, not here.
|
|
90
|
+
* @param options The `host` and `port` of the daemon, with the PEM contents of the authority (`ca`), the client
|
|
91
|
+
* certificate (`cert`) and its key (`key`), the headers, the timeout and the API version; the `protocol` is set to
|
|
92
|
+
* `'https'`.
|
|
93
|
+
* @returns The component options (`{class: Docker, protocol: 'https', ...options}`).
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import {readFileSync} from 'node:fs'
|
|
97
|
+
* import {Application} from 'lakutata'
|
|
98
|
+
* import {buildDockerHttpsConnectionOptions} from 'lakutata/com/docker'
|
|
99
|
+
*
|
|
100
|
+
* Application.run(() => ({
|
|
101
|
+
* id: 'docker.app',
|
|
102
|
+
* name: 'Docker',
|
|
103
|
+
* components: {
|
|
104
|
+
* //The PEM contents, not the file paths
|
|
105
|
+
* docker: buildDockerHttpsConnectionOptions({
|
|
106
|
+
* host: 'docker.example.com',
|
|
107
|
+
* port: 2376,
|
|
108
|
+
* ca: readFileSync('/etc/docker/certs/ca.pem'),
|
|
109
|
+
* cert: readFileSync('/etc/docker/certs/cert.pem'),
|
|
110
|
+
* key: readFileSync('/etc/docker/certs/key.pem')
|
|
111
|
+
* })
|
|
112
|
+
* }
|
|
113
|
+
* }))
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
const buildDockerHttpsConnectionOptions = (options) => ({
|
|
117
|
+
...options,
|
|
118
|
+
protocol: 'https',
|
|
119
|
+
class: Docker_js_1.Docker
|
|
120
|
+
});
|
|
121
|
+
exports.buildDockerHttpsConnectionOptions = buildDockerHttpsConnectionOptions;
|
|
122
|
+
/**
|
|
123
|
+
* Build the component options of a {@link Docker} connected to a remote daemon over SSH, as `DOCKER_HOST=ssh://user@host`
|
|
124
|
+
* does, to register it in the `components` of an application. The requests go through `docker system dial-stdio` run on
|
|
125
|
+
* the remote host, which needs the Docker CLI; locally, the optional package `ssh2` must be installed. The SSH connection
|
|
126
|
+
* authenticates through the SSH agent (no password). The options are validated when the component is created, not here.
|
|
127
|
+
* @param options The `host` and `port` (the SSH port, usually 22) of the remote host, the `username`, the SSH agent's
|
|
128
|
+
* socket (`sshAuthAgent`; `SSH_AUTH_SOCK` by default), the timeout and the API version; the `protocol` is set to
|
|
129
|
+
* `'ssh'`.
|
|
130
|
+
* @returns The component options (`{class: Docker, protocol: 'ssh', ...options}`).
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* import {Application} from 'lakutata'
|
|
134
|
+
* import {buildDockerSSHConnectionOptions} from 'lakutata/com/docker'
|
|
135
|
+
*
|
|
136
|
+
* Application.run(() => ({
|
|
137
|
+
* id: 'docker.app',
|
|
138
|
+
* name: 'Docker',
|
|
139
|
+
* components: {
|
|
140
|
+
* docker: buildDockerSSHConnectionOptions({host: 'docker.example.com', port: 22, username: 'deploy'})
|
|
141
|
+
* }
|
|
142
|
+
* }))
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
const buildDockerSSHConnectionOptions = (options) => ({
|
|
146
|
+
...options,
|
|
147
|
+
protocol: 'ssh',
|
|
148
|
+
class: Docker_js_1.Docker
|
|
149
|
+
});
|
|
150
|
+
exports.buildDockerSSHConnectionOptions = buildDockerSSHConnectionOptions;
|