@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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContainerRemoveOptions = void 0;
|
|
13
|
+
const core_1 = require("@lakutata/core");
|
|
14
|
+
const dto_1 = require("@lakutata/core/decorator/dto");
|
|
15
|
+
/**
|
|
16
|
+
* How `DockerContainer.remove()` removes a container (`docker rm -v`): its anonymous volumes are removed with it, the
|
|
17
|
+
* named volumes are kept.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
21
|
+
*
|
|
22
|
+
* declare const docker: Docker
|
|
23
|
+
*
|
|
24
|
+
* const container = await docker.getContainer('web')
|
|
25
|
+
* await container.remove({force: true})
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class ContainerRemoveOptions extends core_1.DTO {
|
|
29
|
+
}
|
|
30
|
+
exports.ContainerRemoveOptions = ContainerRemoveOptions;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, dto_1.Expect)(core_1.DTO.Boolean().optional().default(false)),
|
|
33
|
+
__metadata("design:type", Boolean)
|
|
34
|
+
], ContainerRemoveOptions.prototype, "force", void 0);
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import { ContainerDevice } from '../../types/ContainerDevice.js';
|
|
3
|
+
import { type ContainerRestartPolicy } from '../../types/ContainerRestartPolicy.js';
|
|
4
|
+
import { ContainerPort } from '../../types/ContainerPort.js';
|
|
5
|
+
import { ContainerBind } from '../../types/ContainerBind.js';
|
|
6
|
+
import { ContainerNetwork } from '../../types/ContainerNetwork.js';
|
|
7
|
+
import { ContainerCapability } from '../../types/ContainerCapability.js';
|
|
8
|
+
/**
|
|
9
|
+
* The settings of a container: given to {@link Docker.createContainer} and `DockerImage.run()` (create, then start),
|
|
10
|
+
* which use the image's defaults (command, environment…) for the settings absent, and to `DockerContainer.update()`,
|
|
11
|
+
* which changes the settings given and keeps the others: the limits and the restart policy live, the others by
|
|
12
|
+
* recreating the container. Every option is optional.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import {Docker, ContainerCapability} from 'lakutata/com/docker'
|
|
16
|
+
*
|
|
17
|
+
* declare const docker: Docker
|
|
18
|
+
*
|
|
19
|
+
* const image = await docker.pullImage({repo: 'nginx', tag: '1.27'})
|
|
20
|
+
* const container = await image.run({
|
|
21
|
+
* name: 'web',
|
|
22
|
+
* env: {TZ: 'UTC'},
|
|
23
|
+
* memoryLimit: 256 * 1024 * 1024,
|
|
24
|
+
* restartPolicy: 'unless-stopped',
|
|
25
|
+
* ports: [{port: 80, type: 'tcp', hostPorts: [8080]}],
|
|
26
|
+
* binds: [{hostPath: '/srv/web/html', containerPath: '/usr/share/nginx/html', rw: false}],
|
|
27
|
+
* networks: [{networkName: 'front'}],
|
|
28
|
+
* capabilities: [ContainerCapability.NET_ADMIN]
|
|
29
|
+
* })
|
|
30
|
+
* //The same container, with 512 MiB of memory, restarted 3 times at most when it fails
|
|
31
|
+
* await container.update({memoryLimit: 512 * 1024 * 1024, restartPolicy: 'on-failure:3'})
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class ContainerSettingOptions extends DTO {
|
|
35
|
+
/**
|
|
36
|
+
* The container name, unique on the Docker host: letters, digits, `_`, `.` and `-`, starting with a letter or a
|
|
37
|
+
* digit. Docker generates one (`happy_turing`) when absent.
|
|
38
|
+
*/
|
|
39
|
+
name?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The host name seen in the container; Docker uses the first 12 characters of the container ID when absent.
|
|
42
|
+
*/
|
|
43
|
+
hostname?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Run the container privileged (`docker run --privileged`): every capability and every host device, without the
|
|
46
|
+
* security restrictions. It gives the container full access to the host.
|
|
47
|
+
*/
|
|
48
|
+
privileged?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Give the container's main process a terminal (`docker run -t`): its output is then not multiplexed, and
|
|
51
|
+
* `DockerContainer.logs()` gives it as written.
|
|
52
|
+
*/
|
|
53
|
+
tty?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The environment variables, by name (`{NODE_ENV: 'production'}`), added to the image's ones; the values are
|
|
56
|
+
* strings.
|
|
57
|
+
*/
|
|
58
|
+
env?: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* The memory limit, in bytes (`256 * 1024 * 1024` for 256 MiB); Docker requires at least 6 MiB. `0` or absent for
|
|
61
|
+
* no limit. The swap limit is Docker's default: as much swap as memory.
|
|
62
|
+
* @default 0
|
|
63
|
+
*/
|
|
64
|
+
memoryLimit?: number;
|
|
65
|
+
/**
|
|
66
|
+
* The indexes of the host CPUs the container may run on (`[0, 1]`, sent to Docker as `"0,1"`); all of them when
|
|
67
|
+
* absent. Each one is an integer.
|
|
68
|
+
*/
|
|
69
|
+
cpuSet?: number[];
|
|
70
|
+
/**
|
|
71
|
+
* When Docker restarts the container after it exits: `''`, `'no'`, `'always'`, `'unless-stopped'`,
|
|
72
|
+
* `'on-failure'` (with no limit on the retries) or `'on-failure:N'` (`N` retries at most, `'on-failure:3'`); another
|
|
73
|
+
* value fails the validation. `''` or absent for no restart.
|
|
74
|
+
*/
|
|
75
|
+
restartPolicy?: ContainerRestartPolicy;
|
|
76
|
+
/**
|
|
77
|
+
* The container ports published on the host (`docker run -p`), each one required to have a `port` (a valid port
|
|
78
|
+
* number) and a `type` (`'tcp'` or `'udp'`), sent to Docker as `"80/tcp"`. Its `hostPorts` are the host ports
|
|
79
|
+
* forwarded to it, bound on every host address (`[8080]`, each one once); empty, or absent, it is published on no
|
|
80
|
+
* host port.
|
|
81
|
+
*/
|
|
82
|
+
ports?: (Pick<ContainerPort, 'port' | 'type'> & Partial<Pick<ContainerPort, 'hostPorts'>>)[];
|
|
83
|
+
/**
|
|
84
|
+
* The host files and directories mounted into the container (`docker run -v`), each one required to have its
|
|
85
|
+
* `hostPath`, its `containerPath` and `rw` (`false` for read-only); sent to Docker as
|
|
86
|
+
* `"hostPath:containerPath:rw"` or `"hostPath:containerPath:ro"`.
|
|
87
|
+
*/
|
|
88
|
+
binds?: ContainerBind[];
|
|
89
|
+
/**
|
|
90
|
+
* The host devices made available in the container (`docker run --device`), each one required to have its
|
|
91
|
+
* `hostPath` and its `containerPath`; its `cgroupPermissions`, a combination of `r`, `w` and `m`, is `'rwm'` by
|
|
92
|
+
* default.
|
|
93
|
+
*/
|
|
94
|
+
devices?: (Pick<ContainerDevice, 'hostPath' | 'containerPath'> & Partial<Pick<ContainerDevice, 'cgroupPermissions'>>)[];
|
|
95
|
+
/**
|
|
96
|
+
* The networks the container is connected to, each one required to have its `networkName`; the default `bridge`
|
|
97
|
+
* network when absent. On a user-defined network, `ip` (an IPv4 address) and `ipv6` (an IPv6 address) set the
|
|
98
|
+
* container's static addresses, within the network's range; empty or absent, Docker allocates them. They are
|
|
99
|
+
* ignored on `bridge`, `host` and `none`.
|
|
100
|
+
*/
|
|
101
|
+
networks?: (Pick<ContainerNetwork, 'networkName'> & Partial<Pick<ContainerNetwork, 'ip' | 'ipv6'>>)[];
|
|
102
|
+
/**
|
|
103
|
+
* Keep the kernel's OOM killer from killing the container's processes when it runs out of memory; set it with a
|
|
104
|
+
* memory limit only, or the host may kill its own processes instead.
|
|
105
|
+
*/
|
|
106
|
+
OOMKillDisable?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The Linux capabilities added to Docker's default set (`docker run --cap-add`); a value outside
|
|
109
|
+
* {@link ContainerCapability} fails the validation. None added when absent (`update()` keeps the container's).
|
|
110
|
+
*/
|
|
111
|
+
capabilities?: ContainerCapability[];
|
|
112
|
+
/**
|
|
113
|
+
* The cgroup the container runs in (the Docker Engine's `HostConfig.Cgroup`): `'container:<name|id>'` shares
|
|
114
|
+
* another container's cgroup; its own when absent.
|
|
115
|
+
*/
|
|
116
|
+
cgroup?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The parent cgroup the container's cgroup is created under (`docker run --cgroup-parent`); a relative path is
|
|
119
|
+
* relative to the cgroup of the init process. The cgroups are created when missing.
|
|
120
|
+
*/
|
|
121
|
+
cgroupParent?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The PID namespace of the container (`docker run --pid`): `'container:<name|id>'` joins another container's,
|
|
124
|
+
* `'host'` uses the host's; its own when absent.
|
|
125
|
+
*/
|
|
126
|
+
pidMode?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The command, replacing the image's `CMD`: the executable followed by its arguments (`['node', 'server.js']`), an
|
|
129
|
+
* array only.
|
|
130
|
+
*/
|
|
131
|
+
cmd?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* The entry point, replacing the image's `ENTRYPOINT`: the executable followed by its arguments, an array only.
|
|
134
|
+
* `['']` removes the image's entry point: the command runs alone.
|
|
135
|
+
*/
|
|
136
|
+
entrypoint?: string[];
|
|
137
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContainerSettingOptions = void 0;
|
|
13
|
+
const core_1 = require("@lakutata/core");
|
|
14
|
+
const dto_1 = require("@lakutata/core/decorator/dto");
|
|
15
|
+
const ContainerCapability_js_1 = require("../../types/ContainerCapability.js");
|
|
16
|
+
/**
|
|
17
|
+
* The settings of a container: given to {@link Docker.createContainer} and `DockerImage.run()` (create, then start),
|
|
18
|
+
* which use the image's defaults (command, environment…) for the settings absent, and to `DockerContainer.update()`,
|
|
19
|
+
* which changes the settings given and keeps the others: the limits and the restart policy live, the others by
|
|
20
|
+
* recreating the container. Every option is optional.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import {Docker, ContainerCapability} from 'lakutata/com/docker'
|
|
24
|
+
*
|
|
25
|
+
* declare const docker: Docker
|
|
26
|
+
*
|
|
27
|
+
* const image = await docker.pullImage({repo: 'nginx', tag: '1.27'})
|
|
28
|
+
* const container = await image.run({
|
|
29
|
+
* name: 'web',
|
|
30
|
+
* env: {TZ: 'UTC'},
|
|
31
|
+
* memoryLimit: 256 * 1024 * 1024,
|
|
32
|
+
* restartPolicy: 'unless-stopped',
|
|
33
|
+
* ports: [{port: 80, type: 'tcp', hostPorts: [8080]}],
|
|
34
|
+
* binds: [{hostPath: '/srv/web/html', containerPath: '/usr/share/nginx/html', rw: false}],
|
|
35
|
+
* networks: [{networkName: 'front'}],
|
|
36
|
+
* capabilities: [ContainerCapability.NET_ADMIN]
|
|
37
|
+
* })
|
|
38
|
+
* //The same container, with 512 MiB of memory, restarted 3 times at most when it fails
|
|
39
|
+
* await container.update({memoryLimit: 512 * 1024 * 1024, restartPolicy: 'on-failure:3'})
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class ContainerSettingOptions extends core_1.DTO {
|
|
43
|
+
}
|
|
44
|
+
exports.ContainerSettingOptions = ContainerSettingOptions;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], ContainerSettingOptions.prototype, "name", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], ContainerSettingOptions.prototype, "hostname", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, dto_1.Expect)(core_1.DTO.Boolean().optional()),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], ContainerSettingOptions.prototype, "privileged", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, dto_1.Expect)(core_1.DTO.Boolean().optional()),
|
|
59
|
+
__metadata("design:type", Boolean)
|
|
60
|
+
], ContainerSettingOptions.prototype, "tty", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, dto_1.Expect)(core_1.DTO.Object().optional()),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], ContainerSettingOptions.prototype, "env", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, dto_1.Expect)(core_1.DTO.Number().optional()),
|
|
67
|
+
__metadata("design:type", Number)
|
|
68
|
+
], ContainerSettingOptions.prototype, "memoryLimit", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.Number().integer()).optional()),
|
|
71
|
+
__metadata("design:type", Array)
|
|
72
|
+
], ContainerSettingOptions.prototype, "cpuSet", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, dto_1.Expect)(core_1.DTO.Alternatives(core_1.DTO.String().allow('').valid('', 'no', 'always', 'unless-stopped', 'on-failure'), core_1.DTO.String().pattern(/^on-failure:\d+$/)).optional()),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], ContainerSettingOptions.prototype, "restartPolicy", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.Object({
|
|
79
|
+
port: core_1.DTO.Number().port().required(),
|
|
80
|
+
type: core_1.DTO.String().valid('tcp', 'udp').required(),
|
|
81
|
+
hostPorts: core_1.DTO.Array(core_1.DTO.Number().port()).optional().default([])
|
|
82
|
+
})).optional()),
|
|
83
|
+
__metadata("design:type", Array)
|
|
84
|
+
], ContainerSettingOptions.prototype, "ports", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.Object({
|
|
87
|
+
hostPath: core_1.DTO.String().required(),
|
|
88
|
+
containerPath: core_1.DTO.String().required(),
|
|
89
|
+
rw: core_1.DTO.Boolean().required()
|
|
90
|
+
})).optional()),
|
|
91
|
+
__metadata("design:type", Array)
|
|
92
|
+
], ContainerSettingOptions.prototype, "binds", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.Object({
|
|
95
|
+
hostPath: core_1.DTO.String().required(),
|
|
96
|
+
containerPath: core_1.DTO.String().required(),
|
|
97
|
+
cgroupPermissions: core_1.DTO.String().optional().default('rwm')
|
|
98
|
+
})).optional()),
|
|
99
|
+
__metadata("design:type", Array)
|
|
100
|
+
], ContainerSettingOptions.prototype, "devices", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.Object({
|
|
103
|
+
networkName: core_1.DTO.String().required(),
|
|
104
|
+
ip: core_1.DTO.String().allow('').ip({ version: 'ipv4' }).optional(),
|
|
105
|
+
ipv6: core_1.DTO.String().allow('').ip({ version: 'ipv6' }).optional()
|
|
106
|
+
})).optional()),
|
|
107
|
+
__metadata("design:type", Array)
|
|
108
|
+
], ContainerSettingOptions.prototype, "networks", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, dto_1.Expect)(core_1.DTO.Boolean().optional()),
|
|
111
|
+
__metadata("design:type", Boolean)
|
|
112
|
+
], ContainerSettingOptions.prototype, "OOMKillDisable", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.String().valid(...Object.values(ContainerCapability_js_1.ContainerCapability))).optional()),
|
|
115
|
+
__metadata("design:type", Array)
|
|
116
|
+
], ContainerSettingOptions.prototype, "capabilities", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
119
|
+
__metadata("design:type", String)
|
|
120
|
+
], ContainerSettingOptions.prototype, "cgroup", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], ContainerSettingOptions.prototype, "cgroupParent", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
127
|
+
__metadata("design:type", String)
|
|
128
|
+
], ContainerSettingOptions.prototype, "pidMode", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.String()).optional()),
|
|
131
|
+
__metadata("design:type", Array)
|
|
132
|
+
], ContainerSettingOptions.prototype, "cmd", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, dto_1.Expect)(core_1.DTO.Array(core_1.DTO.String()).optional()),
|
|
135
|
+
__metadata("design:type", Array)
|
|
136
|
+
], ContainerSettingOptions.prototype, "entrypoint", void 0);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* How `DockerContainer.stop()` and `DockerContainer.restart()` stop a running container (`docker stop`): Docker sends
|
|
4
|
+
* the stop signal to its main process, then kills it with `SIGKILL` when it has not exited after the timeout.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* //Up to 30 seconds to finish the requests in progress
|
|
13
|
+
* await container.stop({signal: 'SIGINT', timeout: 30})
|
|
14
|
+
* await container.restart({timeout: 5})
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContainerStopOptions extends DTO {
|
|
18
|
+
/**
|
|
19
|
+
* The signal sent first, a name (`'SIGINT'`) or a number (`'2'`); the container's stop signal when absent (its
|
|
20
|
+
* image's `STOPSIGNAL`, `SIGTERM` by default).
|
|
21
|
+
*/
|
|
22
|
+
signal?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The time given to the container to exit before it is killed, in seconds (a whole number); the container's stop
|
|
25
|
+
* timeout when absent, 10 seconds by default.
|
|
26
|
+
*/
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContainerStopOptions = void 0;
|
|
13
|
+
const core_1 = require("@lakutata/core");
|
|
14
|
+
const dto_1 = require("@lakutata/core/decorator/dto");
|
|
15
|
+
/**
|
|
16
|
+
* How `DockerContainer.stop()` and `DockerContainer.restart()` stop a running container (`docker stop`): Docker sends
|
|
17
|
+
* the stop signal to its main process, then kills it with `SIGKILL` when it has not exited after the timeout.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
21
|
+
*
|
|
22
|
+
* declare const docker: Docker
|
|
23
|
+
*
|
|
24
|
+
* const container = await docker.getContainer('web')
|
|
25
|
+
* //Up to 30 seconds to finish the requests in progress
|
|
26
|
+
* await container.stop({signal: 'SIGINT', timeout: 30})
|
|
27
|
+
* await container.restart({timeout: 5})
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
class ContainerStopOptions extends core_1.DTO {
|
|
31
|
+
}
|
|
32
|
+
exports.ContainerStopOptions = ContainerStopOptions;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, dto_1.Expect)(core_1.DTO.String().optional()),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ContainerStopOptions.prototype, "signal", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, dto_1.Expect)(core_1.DTO.Number().optional()),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], ContainerStopOptions.prototype, "timeout", void 0);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The size of a container terminal, in characters: its initial size ({@link ContainerCreateTTYOptions.consoleSize}),
|
|
4
|
+
* and its new size given to `DockerContainerTTY.resize()` when the user's terminal is resized. Both are required.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* const tty = await container.createTTY({cmd: 'sh', consoleSize: {cols: 120, rows: 40}})
|
|
13
|
+
* //The user's terminal was resized
|
|
14
|
+
* await tty.resize({cols: 160, rows: 50})
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContainerTTYConsoleSizeOptions extends DTO {
|
|
18
|
+
/**
|
|
19
|
+
* The width, in columns (characters). Required.
|
|
20
|
+
*/
|
|
21
|
+
cols: number;
|
|
22
|
+
/**
|
|
23
|
+
* The height, in rows (lines). Required.
|
|
24
|
+
*/
|
|
25
|
+
rows: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContainerTTYConsoleSizeOptions = void 0;
|
|
13
|
+
const core_1 = require("@lakutata/core");
|
|
14
|
+
const dto_1 = require("@lakutata/core/decorator/dto");
|
|
15
|
+
/**
|
|
16
|
+
* The size of a container terminal, in characters: its initial size ({@link ContainerCreateTTYOptions.consoleSize}),
|
|
17
|
+
* and its new size given to `DockerContainerTTY.resize()` when the user's terminal is resized. Both are required.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
21
|
+
*
|
|
22
|
+
* declare const docker: Docker
|
|
23
|
+
*
|
|
24
|
+
* const container = await docker.getContainer('web')
|
|
25
|
+
* const tty = await container.createTTY({cmd: 'sh', consoleSize: {cols: 120, rows: 40}})
|
|
26
|
+
* //The user's terminal was resized
|
|
27
|
+
* await tty.resize({cols: 160, rows: 50})
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
class ContainerTTYConsoleSizeOptions extends core_1.DTO {
|
|
31
|
+
}
|
|
32
|
+
exports.ContainerTTYConsoleSizeOptions = ContainerTTYConsoleSizeOptions;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, dto_1.Expect)(core_1.DTO.Number().required()),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], ContainerTTYConsoleSizeOptions.prototype, "cols", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, dto_1.Expect)(core_1.DTO.Number().required()),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], ContainerTTYConsoleSizeOptions.prototype, "rows", void 0);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import type { DockerOutputCallback } from '../../types/DockerOutputCallback.js';
|
|
3
|
+
import { DockerAuthOptions } from '../auth/DockerAuthOptions.js';
|
|
4
|
+
/**
|
|
5
|
+
* How {@link Docker.buildImage} builds an image with BuildKit (`docker build`), the built image returned. The build
|
|
6
|
+
* context is the listed files and directories of the working directory, without the ones its `.dockerignore` excludes;
|
|
7
|
+
* the Dockerfile is always sent. `workdir` and `files` are required.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
11
|
+
*
|
|
12
|
+
* declare const docker: Docker
|
|
13
|
+
*
|
|
14
|
+
* const image = await docker.buildImage({
|
|
15
|
+
* workdir: '/srv/projects/api',
|
|
16
|
+
* files: ['package.json', 'package-lock.json', 'dist'],
|
|
17
|
+
* repoTag: 'api:1.4.0',
|
|
18
|
+
* platform: 'linux/amd64',
|
|
19
|
+
* buildargs: {NODE_VERSION: '22'},
|
|
20
|
+
* outputCallback: (output: Record<string, any>): void => {
|
|
21
|
+
* if (output.stream) console.log(output.stream)
|
|
22
|
+
* }
|
|
23
|
+
* })
|
|
24
|
+
* console.log(image.id)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class ImageBuildOptions extends DTO {
|
|
28
|
+
/**
|
|
29
|
+
* The directory of the build context on this machine, holding the Dockerfile and its `.dockerignore`. Required.
|
|
30
|
+
*/
|
|
31
|
+
workdir: string;
|
|
32
|
+
/**
|
|
33
|
+
* The files and directories of `workdir` sent as the build context, their paths relative to it (`['package.json',
|
|
34
|
+
* 'dist']`); the directories are sent with their content, the files excluded by `.dockerignore` are skipped, and
|
|
35
|
+
* the Dockerfile is added. Required.
|
|
36
|
+
*/
|
|
37
|
+
files: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The path of the Dockerfile in the build context, relative to `workdir`. Ignored when `remote` points to a
|
|
40
|
+
* Dockerfile.
|
|
41
|
+
* @default 'Dockerfile'
|
|
42
|
+
*/
|
|
43
|
+
dockerfile?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The repository and tag of the image, `name:tag` (`api:1.4.0`); a name without a tag is tagged `latest`. When
|
|
46
|
+
* absent, the image is named `unnamed_img_<random hexadecimal>:latest`.
|
|
47
|
+
*/
|
|
48
|
+
repoTag?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The platform of the image, `os[/arch[/variant]]` (`linux/amd64`, `linux/arm64/v8`); `''` for the Docker host's
|
|
51
|
+
* platform.
|
|
52
|
+
* @default ''
|
|
53
|
+
*/
|
|
54
|
+
platform?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The stage of a multi-stage Dockerfile to build (`FROM … AS <stage>`); `''` for the last stage.
|
|
57
|
+
* @default ''
|
|
58
|
+
*/
|
|
59
|
+
target?: string;
|
|
60
|
+
/**
|
|
61
|
+
* A remote build context: a Git repository URL or an HTTP/HTTPS URL. A URL of a text file is used as the
|
|
62
|
+
* Dockerfile; a URL of a tarball is downloaded by Docker and used as the context, which must then hold the
|
|
63
|
+
* `dockerfile` path.
|
|
64
|
+
*/
|
|
65
|
+
remote?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Suppress the verbose build output (`docker build --quiet`).
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
quiet?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The former, misspelt name of {@link ImageBuildOptions.quiet}: the build is quiet when either is `true`.
|
|
73
|
+
* @deprecated Use `quiet`.
|
|
74
|
+
*/
|
|
75
|
+
quite?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Build without the build cache (`docker build --no-cache`).
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
nocache?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Remove the intermediate containers after a successful build (the legacy builder's `--rm`; BuildKit creates
|
|
83
|
+
* none).
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
rm?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Always remove the intermediate containers, even after a failure (the legacy builder's `--force-rm`; BuildKit
|
|
89
|
+
* creates none).
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
forcerm?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The size of `/dev/shm` in the build containers, in bytes, greater than 0; 64 MiB when absent.
|
|
95
|
+
*/
|
|
96
|
+
shmsize?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The build arguments, by name (`{NODE_VERSION: '22'}`): the values of the Dockerfile's `ARG` instructions, in the
|
|
99
|
+
* environment of its `RUN` instructions and expanded in its other instructions. They stay visible in the image's
|
|
100
|
+
* history: not for the secrets.
|
|
101
|
+
*/
|
|
102
|
+
buildargs?: {
|
|
103
|
+
[key: string]: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* The credentials of a private registry the base images come from. When given, the images of the Dockerfile's
|
|
107
|
+
* `FROM` instructions are pulled first with them (on `platform`, their progress given to `outputCallback`), and
|
|
108
|
+
* BuildKit is given them (the tokens included) for `auth.serverAddress`.
|
|
109
|
+
*/
|
|
110
|
+
auth?: DockerAuthOptions;
|
|
111
|
+
/**
|
|
112
|
+
* Receive the build progress as it arrives: the BuildKit progress as the lines of `docker build --progress=plain`
|
|
113
|
+
* (`{id: 'moby.buildkit.trace', stream: '#2 [1/2] FROM alpine'}`), and the other messages of Docker as they are
|
|
114
|
+
* sent (the built image's ID, `{aux: {ID: 'sha256:…'}}`, the errors, `{error: '…'}`).
|
|
115
|
+
*/
|
|
116
|
+
outputCallback?: DockerOutputCallback;
|
|
117
|
+
}
|