@lakutata/containerd 0.0.0-stage → 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 +409 -2
- package/THIRD_PARTY_NOTICES.md +310 -0
- package/dist/cjs/client/BuildKit.d.ts +176 -0
- package/dist/cjs/client/BuildKit.js +536 -0
- package/dist/cjs/client/BuildKitMessages.d.ts +35 -0
- package/dist/cjs/client/BuildKitMessages.js +123 -0
- package/dist/cjs/client/ContainerStore.d.ts +558 -0
- package/dist/cjs/client/ContainerStore.js +1384 -0
- package/dist/cjs/client/ContainerdClient.d.ts +244 -0
- package/dist/cjs/client/ContainerdClient.js +455 -0
- package/dist/cjs/client/DockerIgnore.d.ts +44 -0
- package/dist/cjs/client/DockerIgnore.js +186 -0
- package/dist/cjs/client/Fifo.d.ts +31 -0
- package/dist/cjs/client/Fifo.js +66 -0
- package/dist/cjs/client/ImageStore.d.ts +258 -0
- package/dist/cjs/client/ImageStore.js +636 -0
- package/dist/cjs/client/Messages.d.ts +103 -0
- package/dist/cjs/client/Messages.js +397 -0
- package/dist/cjs/client/Networks.d.ts +221 -0
- package/dist/cjs/client/Networks.js +630 -0
- package/dist/cjs/client/Platforms.d.ts +53 -0
- package/dist/cjs/client/Platforms.js +169 -0
- package/dist/cjs/client/Reference.d.ts +33 -0
- package/dist/cjs/client/Reference.js +70 -0
- package/dist/cjs/client/Registry.d.ts +145 -0
- package/dist/cjs/client/Registry.js +272 -0
- package/dist/cjs/client/Rootfs.d.ts +83 -0
- package/dist/cjs/client/Rootfs.js +245 -0
- package/dist/cjs/client/Seccomp.d.ts +36 -0
- package/dist/cjs/client/Seccomp.js +156 -0
- package/dist/cjs/client/Spec.d.ts +151 -0
- package/dist/cjs/client/Spec.js +227 -0
- package/dist/cjs/client/Volumes.d.ts +42 -0
- package/dist/cjs/client/Volumes.js +80 -0
- package/dist/cjs/containerd/Containerd.d.ts +442 -0
- package/dist/cjs/containerd/Containerd.js +929 -0
- package/dist/cjs/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdConnectionException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.js +17 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageExportException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageImportException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePullException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePushException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdPlatformException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.js +15 -0
- package/dist/cjs/containerd/lib/ContainerdContainer.d.ts +292 -0
- package/dist/cjs/containerd/lib/ContainerdContainer.js +536 -0
- package/dist/cjs/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
- package/dist/cjs/containerd/lib/ContainerdContainerTTY.js +178 -0
- package/dist/cjs/containerd/lib/ContainerdErrors.d.ts +6 -0
- package/dist/cjs/containerd/lib/ContainerdErrors.js +37 -0
- package/dist/cjs/containerd/lib/ContainerdImage.d.ts +149 -0
- package/dist/cjs/containerd/lib/ContainerdImage.js +222 -0
- package/dist/cjs/containerd/options/ContainerdPruneOptions.d.ts +44 -0
- package/dist/cjs/containerd/options/ContainerdPruneOptions.js +51 -0
- package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
- package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.js +45 -0
- package/dist/cjs/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
- package/dist/cjs/containerd/options/container/ContainerCommitOptions.js +66 -0
- package/dist/cjs/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
- package/dist/cjs/containerd/options/container/ContainerCreateOptions.js +239 -0
- package/dist/cjs/containerd/options/container/ContainerExecOptions.d.ts +53 -0
- package/dist/cjs/containerd/options/container/ContainerExecOptions.js +63 -0
- package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
- package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.js +45 -0
- package/dist/cjs/containerd/options/container/ContainerKillOptions.d.ts +30 -0
- package/dist/cjs/containerd/options/container/ContainerKillOptions.js +41 -0
- package/dist/cjs/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
- package/dist/cjs/containerd/options/container/ContainerLogsOptions.js +44 -0
- package/dist/cjs/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/cjs/containerd/options/container/ContainerRemoveOptions.js +34 -0
- package/dist/cjs/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
- package/dist/cjs/containerd/options/container/ContainerResourceOptions.js +67 -0
- package/dist/cjs/containerd/options/container/ContainerStopOptions.d.ts +30 -0
- package/dist/cjs/containerd/options/container/ContainerStopOptions.js +41 -0
- package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
- package/dist/cjs/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
- package/dist/cjs/containerd/options/container/ContainerTTYOptions.js +63 -0
- package/dist/cjs/containerd/options/image/ImageBuildOptions.d.ts +88 -0
- package/dist/cjs/containerd/options/image/ImageBuildOptions.js +95 -0
- package/dist/cjs/containerd/options/image/ImageExportOptions.d.ts +25 -0
- package/dist/cjs/containerd/options/image/ImageExportOptions.js +39 -0
- package/dist/cjs/containerd/options/image/ImageImportOptions.d.ts +38 -0
- package/dist/cjs/containerd/options/image/ImageImportOptions.js +47 -0
- package/dist/cjs/containerd/options/image/ImagePullOptions.d.ts +53 -0
- package/dist/cjs/containerd/options/image/ImagePullOptions.js +66 -0
- package/dist/cjs/containerd/options/image/ImagePushOptions.d.ts +44 -0
- package/dist/cjs/containerd/options/image/ImagePushOptions.js +58 -0
- package/dist/cjs/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
- package/dist/cjs/containerd/options/network/NetworkCreateOptions.js +83 -0
- package/dist/cjs/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
- package/dist/cjs/containerd/options/volume/VolumeCreateOptions.js +40 -0
- package/dist/cjs/containerd/types/ContainerdBind.d.ts +28 -0
- package/dist/cjs/containerd/types/ContainerdBind.js +2 -0
- package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
- package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
- package/dist/cjs/containerd/types/ContainerdContainerNetwork.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerPort.d.ts +22 -0
- package/dist/cjs/containerd/types/ContainerdContainerPort.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerState.d.ts +42 -0
- package/dist/cjs/containerd/types/ContainerdContainerState.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerStats.d.ts +107 -0
- package/dist/cjs/containerd/types/ContainerdContainerStats.js +2 -0
- package/dist/cjs/containerd/types/ContainerdDevice.d.ts +25 -0
- package/dist/cjs/containerd/types/ContainerdDevice.js +2 -0
- package/dist/cjs/containerd/types/ContainerdExecResult.d.ts +18 -0
- package/dist/cjs/containerd/types/ContainerdExecResult.js +2 -0
- package/dist/cjs/containerd/types/ContainerdImageConfig.d.ts +46 -0
- package/dist/cjs/containerd/types/ContainerdImageConfig.js +2 -0
- package/dist/cjs/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
- package/dist/cjs/containerd/types/ContainerdNetworkInfo.js +2 -0
- package/dist/cjs/containerd/types/ContainerdProgressCallback.d.ts +29 -0
- package/dist/cjs/containerd/types/ContainerdProgressCallback.js +2 -0
- package/dist/cjs/containerd/types/ContainerdPruneResult.d.ts +21 -0
- package/dist/cjs/containerd/types/ContainerdPruneResult.js +2 -0
- package/dist/cjs/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
- package/dist/cjs/containerd/types/ContainerdRestartPolicy.js +2 -0
- package/dist/cjs/containerd/types/ContainerdTmpfs.d.ts +20 -0
- package/dist/cjs/containerd/types/ContainerdTmpfs.js +2 -0
- package/dist/cjs/containerd/types/ContainerdVolume.d.ts +19 -0
- package/dist/cjs/containerd/types/ContainerdVolume.js +2 -0
- package/dist/cjs/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
- package/dist/cjs/containerd/types/ContainerdVolumeInfo.js +2 -0
- package/dist/cjs/exports/Containerd.d.ts +69 -0
- package/dist/cjs/exports/Containerd.js +87 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/client/BuildKit.js +488 -0
- package/dist/esm/client/BuildKitMessages.js +120 -0
- package/dist/esm/client/ContainerStore.js +1339 -0
- package/dist/esm/client/ContainerdClient.js +416 -0
- package/dist/esm/client/DockerIgnore.js +179 -0
- package/dist/esm/client/Fifo.js +59 -0
- package/dist/esm/client/ImageStore.js +628 -0
- package/dist/esm/client/Messages.js +393 -0
- package/dist/esm/client/Networks.js +621 -0
- package/dist/esm/client/Platforms.js +156 -0
- package/dist/esm/client/Reference.js +66 -0
- package/dist/esm/client/Registry.js +263 -0
- package/dist/esm/client/Rootfs.js +234 -0
- package/dist/esm/client/Seccomp.js +152 -0
- package/dist/esm/client/Spec.js +220 -0
- package/dist/esm/client/Volumes.js +73 -0
- package/dist/esm/containerd/Containerd.js +923 -0
- package/dist/esm/containerd/exceptions/ContainerdConnectionException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerNameConflictException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerStateException.js +13 -0
- package/dist/esm/containerd/exceptions/ContainerdImageBuildException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageExportException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageImportException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImagePullException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImagePushException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdNetworkConflictException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdNetworkNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdPathNotFoundException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdPlatformException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdVolumeInUseException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdVolumeNotFoundException.js +11 -0
- package/dist/esm/containerd/lib/ContainerdContainer.js +533 -0
- package/dist/esm/containerd/lib/ContainerdContainerTTY.js +175 -0
- package/dist/esm/containerd/lib/ContainerdErrors.js +34 -0
- package/dist/esm/containerd/lib/ContainerdImage.js +219 -0
- package/dist/esm/containerd/options/ContainerdPruneOptions.js +47 -0
- package/dist/esm/containerd/options/ContainerdRegistryAuthOptions.js +41 -0
- package/dist/esm/containerd/options/container/ContainerCommitOptions.js +62 -0
- package/dist/esm/containerd/options/container/ContainerCreateOptions.js +235 -0
- package/dist/esm/containerd/options/container/ContainerExecOptions.js +59 -0
- package/dist/esm/containerd/options/container/ContainerExportDirectoryOptions.js +41 -0
- package/dist/esm/containerd/options/container/ContainerKillOptions.js +37 -0
- package/dist/esm/containerd/options/container/ContainerLogsOptions.js +40 -0
- package/dist/esm/containerd/options/container/ContainerRemoveOptions.js +30 -0
- package/dist/esm/containerd/options/container/ContainerResourceOptions.js +63 -0
- package/dist/esm/containerd/options/container/ContainerStopOptions.js +37 -0
- package/dist/esm/containerd/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
- package/dist/esm/containerd/options/container/ContainerTTYOptions.js +59 -0
- package/dist/esm/containerd/options/image/ImageBuildOptions.js +91 -0
- package/dist/esm/containerd/options/image/ImageExportOptions.js +35 -0
- package/dist/esm/containerd/options/image/ImageImportOptions.js +43 -0
- package/dist/esm/containerd/options/image/ImagePullOptions.js +62 -0
- package/dist/esm/containerd/options/image/ImagePushOptions.js +54 -0
- package/dist/esm/containerd/options/network/NetworkCreateOptions.js +79 -0
- package/dist/esm/containerd/options/volume/VolumeCreateOptions.js +36 -0
- package/dist/esm/containerd/types/ContainerdBind.js +1 -0
- package/dist/esm/containerd/types/ContainerdBuildOutputCallback.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerNetwork.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerPort.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerState.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerStats.js +1 -0
- package/dist/esm/containerd/types/ContainerdDevice.js +1 -0
- package/dist/esm/containerd/types/ContainerdExecResult.js +1 -0
- package/dist/esm/containerd/types/ContainerdImageConfig.js +1 -0
- package/dist/esm/containerd/types/ContainerdNetworkInfo.js +1 -0
- package/dist/esm/containerd/types/ContainerdProgressCallback.js +1 -0
- package/dist/esm/containerd/types/ContainerdPruneResult.js +1 -0
- package/dist/esm/containerd/types/ContainerdRestartPolicy.js +1 -0
- package/dist/esm/containerd/types/ContainerdTmpfs.js +1 -0
- package/dist/esm/containerd/types/ContainerdVolume.js +1 -0
- package/dist/esm/containerd/types/ContainerdVolumeInfo.js +1 -0
- package/dist/esm/exports/Containerd.js +68 -0
- package/dist/types/client/BuildKit.d.ts +176 -0
- package/dist/types/client/BuildKitMessages.d.ts +35 -0
- package/dist/types/client/ContainerStore.d.ts +558 -0
- package/dist/types/client/ContainerdClient.d.ts +244 -0
- package/dist/types/client/DockerIgnore.d.ts +44 -0
- package/dist/types/client/Fifo.d.ts +31 -0
- package/dist/types/client/ImageStore.d.ts +258 -0
- package/dist/types/client/Messages.d.ts +103 -0
- package/dist/types/client/Networks.d.ts +221 -0
- package/dist/types/client/Platforms.d.ts +53 -0
- package/dist/types/client/Reference.d.ts +33 -0
- package/dist/types/client/Registry.d.ts +145 -0
- package/dist/types/client/Rootfs.d.ts +83 -0
- package/dist/types/client/Seccomp.d.ts +36 -0
- package/dist/types/client/Spec.d.ts +151 -0
- package/dist/types/client/Volumes.d.ts +42 -0
- package/dist/types/containerd/Containerd.d.ts +442 -0
- package/dist/types/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
- package/dist/types/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
- package/dist/types/containerd/lib/ContainerdContainer.d.ts +292 -0
- package/dist/types/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
- package/dist/types/containerd/lib/ContainerdErrors.d.ts +6 -0
- package/dist/types/containerd/lib/ContainerdImage.d.ts +149 -0
- package/dist/types/containerd/options/ContainerdPruneOptions.d.ts +44 -0
- package/dist/types/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
- package/dist/types/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
- package/dist/types/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
- package/dist/types/containerd/options/container/ContainerExecOptions.d.ts +53 -0
- package/dist/types/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
- package/dist/types/containerd/options/container/ContainerKillOptions.d.ts +30 -0
- package/dist/types/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
- package/dist/types/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/types/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
- package/dist/types/containerd/options/container/ContainerStopOptions.d.ts +30 -0
- package/dist/types/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/types/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
- package/dist/types/containerd/options/image/ImageBuildOptions.d.ts +88 -0
- package/dist/types/containerd/options/image/ImageExportOptions.d.ts +25 -0
- package/dist/types/containerd/options/image/ImageImportOptions.d.ts +38 -0
- package/dist/types/containerd/options/image/ImagePullOptions.d.ts +53 -0
- package/dist/types/containerd/options/image/ImagePushOptions.d.ts +44 -0
- package/dist/types/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
- package/dist/types/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
- package/dist/types/containerd/types/ContainerdBind.d.ts +28 -0
- package/dist/types/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
- package/dist/types/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
- package/dist/types/containerd/types/ContainerdContainerPort.d.ts +22 -0
- package/dist/types/containerd/types/ContainerdContainerState.d.ts +42 -0
- package/dist/types/containerd/types/ContainerdContainerStats.d.ts +107 -0
- package/dist/types/containerd/types/ContainerdDevice.d.ts +25 -0
- package/dist/types/containerd/types/ContainerdExecResult.d.ts +18 -0
- package/dist/types/containerd/types/ContainerdImageConfig.d.ts +46 -0
- package/dist/types/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
- package/dist/types/containerd/types/ContainerdProgressCallback.d.ts +29 -0
- package/dist/types/containerd/types/ContainerdPruneResult.d.ts +21 -0
- package/dist/types/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
- package/dist/types/containerd/types/ContainerdTmpfs.d.ts +20 -0
- package/dist/types/containerd/types/ContainerdVolume.d.ts +19 -0
- package/dist/types/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
- package/dist/types/exports/Containerd.d.ts +69 -0
- package/package.json +51 -4
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Provider, DTO } from '@lakutata/core';
|
|
11
|
+
import { Transient, Configurable } from '@lakutata/core/decorator/di';
|
|
12
|
+
import { Accept } from '@lakutata/core/decorator/dto';
|
|
13
|
+
import { Duplex } from 'node:stream';
|
|
14
|
+
import { ContainerTTYConsoleSizeOptions } from '../options/container/ContainerTTYConsoleSizeOptions.js';
|
|
15
|
+
import { containerdError } from './ContainerdErrors.js';
|
|
16
|
+
/**
|
|
17
|
+
* An interactive terminal in a running container: a process (a shell by default) run with a pseudo terminal, as
|
|
18
|
+
* `docker exec -it` does. Get it from {@link ContainerdContainer.createTTY}; do not create it yourself. Write its input
|
|
19
|
+
* with {@link ContainerdContainerTTY.write} (or {@link ContainerdContainerTTY.writable}), read its output with
|
|
20
|
+
* {@link ContainerdContainerTTY.onData} (or {@link ContainerdContainerTTY.readable}), or pipe a socket into
|
|
21
|
+
* {@link ContainerdContainerTTY.raw}. The terminal ends when its process exits or when it is closed; it is closed when
|
|
22
|
+
* the object is destroyed.
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import {type Containerd, type ContainerdContainer, type ContainerdContainerTTY} from 'lakutata/com/containerd'
|
|
26
|
+
*
|
|
27
|
+
* declare const containerd: Containerd
|
|
28
|
+
*
|
|
29
|
+
* const container: ContainerdContainer = await containerd.getContainer('worker')
|
|
30
|
+
* const tty: ContainerdContainerTTY = await container.createTTY({cmd: ['/bin/sh', '-l'], consoleSize: {cols: 120, rows: 40}})
|
|
31
|
+
* tty.onData((chunk: Buffer): void => {
|
|
32
|
+
* process.stdout.write(chunk)
|
|
33
|
+
* })
|
|
34
|
+
* tty.write('ls -la\n')
|
|
35
|
+
* await tty.resize({cols: 100, rows: 30})
|
|
36
|
+
* tty.write('exit\n')
|
|
37
|
+
* //The exit code of the shell
|
|
38
|
+
* console.log(await tty.wait())
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
let ContainerdContainerTTY = class ContainerdContainerTTY extends Provider {
|
|
42
|
+
#terminal;
|
|
43
|
+
#duplexStream;
|
|
44
|
+
/**
|
|
45
|
+
* Start the terminal's process in the container.
|
|
46
|
+
* @throws {ContainerdContainerStateException} The container is not running.
|
|
47
|
+
* @throws {Error} The host has no `mkfifo`; the user is not found in the container.
|
|
48
|
+
* @protected
|
|
49
|
+
*/
|
|
50
|
+
async init() {
|
|
51
|
+
try {
|
|
52
|
+
this.#terminal = await this.getStore().terminal(this.getRecord(), {
|
|
53
|
+
cmd: Array.isArray(this.cmd) ? this.cmd : ['/bin/sh', '-c', this.cmd],
|
|
54
|
+
cols: this.initialConsoleSize?.cols,
|
|
55
|
+
rows: this.initialConsoleSize?.rows,
|
|
56
|
+
env: this.env,
|
|
57
|
+
workingDir: this.workingDir,
|
|
58
|
+
user: this.user
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
throw containerdError(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Close the terminal, as {@link ContainerdContainerTTY.close} does.
|
|
67
|
+
* @protected
|
|
68
|
+
*/
|
|
69
|
+
async destroy() {
|
|
70
|
+
await this.close();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The terminal as one duplex stream: writing sends input to the process, reading gives its output (to pipe a
|
|
74
|
+
* WebSocket or a socket into it). It is created at the first access and consumes the output from then on.
|
|
75
|
+
*/
|
|
76
|
+
get raw() {
|
|
77
|
+
//Created once asked: it reads the output (which onData would not have otherwise)
|
|
78
|
+
if (!this.#duplexStream) {
|
|
79
|
+
this.#duplexStream = Duplex.from({ readable: this.#terminal.output, writable: this.#terminal.input });
|
|
80
|
+
this.#duplexStream.on('error', () => undefined);
|
|
81
|
+
}
|
|
82
|
+
return this.#duplexStream;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The terminal's input: what is written is sent to the process, as typed on a keyboard (`\x03` for Ctrl+C).
|
|
86
|
+
*/
|
|
87
|
+
get writable() {
|
|
88
|
+
return this.#terminal.input;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The terminal's output: what the process prints, its standard error included; it ends when the process exits.
|
|
92
|
+
*/
|
|
93
|
+
get readable() {
|
|
94
|
+
return this.#terminal.output;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resize the terminal's console; the process receives `SIGWINCH`.
|
|
98
|
+
* @param options The new size, in columns and rows (positive integers).
|
|
99
|
+
* @throws {GRPCError} The process has exited (from `@lakutata/grpc`).
|
|
100
|
+
*/
|
|
101
|
+
async resize(options) {
|
|
102
|
+
await this.#terminal.resize(options.cols, options.rows);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Listen to the terminal's output. Each call adds a listener.
|
|
106
|
+
* @param handler Called with each chunk of output.
|
|
107
|
+
*/
|
|
108
|
+
onData(handler) {
|
|
109
|
+
this.#terminal.output.on('data', handler);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Send input to the terminal's process.
|
|
113
|
+
* @param data The input, as text or bytes (`'ls\n'`, a newline to submit a line).
|
|
114
|
+
*/
|
|
115
|
+
write(data) {
|
|
116
|
+
this.#terminal.input.write(data);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Wait for the terminal's process to exit; the terminal is then closed.
|
|
120
|
+
* @returns Its exit code (`137` when it was closed by {@link ContainerdContainerTTY.close}).
|
|
121
|
+
*/
|
|
122
|
+
async wait() {
|
|
123
|
+
return await this.#terminal.exited;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Close the terminal: kill its process with `SIGKILL` and release its FIFOs. Nothing happens when it is already
|
|
127
|
+
* closed.
|
|
128
|
+
*/
|
|
129
|
+
async close() {
|
|
130
|
+
await this.#terminal?.close();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
__decorate([
|
|
134
|
+
Configurable(DTO.Function()),
|
|
135
|
+
__metadata("design:type", Function)
|
|
136
|
+
], ContainerdContainerTTY.prototype, "getStore", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
Configurable(DTO.Function()),
|
|
139
|
+
__metadata("design:type", Function)
|
|
140
|
+
], ContainerdContainerTTY.prototype, "getRecord", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
Configurable(DTO.Alternatives(DTO.String(), DTO.Array(DTO.String()).min(1))),
|
|
143
|
+
__metadata("design:type", Object)
|
|
144
|
+
], ContainerdContainerTTY.prototype, "cmd", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
Configurable(ContainerTTYConsoleSizeOptions.optional()),
|
|
147
|
+
__metadata("design:type", ContainerTTYConsoleSizeOptions
|
|
148
|
+
/**
|
|
149
|
+
* The environment variables added to the container's (`TERM` is `xterm` unless given).
|
|
150
|
+
* @default none
|
|
151
|
+
*/
|
|
152
|
+
)
|
|
153
|
+
], ContainerdContainerTTY.prototype, "initialConsoleSize", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
Configurable(DTO.Object().optional()),
|
|
156
|
+
__metadata("design:type", Object)
|
|
157
|
+
], ContainerdContainerTTY.prototype, "env", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
Configurable(DTO.String().optional()),
|
|
160
|
+
__metadata("design:type", String)
|
|
161
|
+
], ContainerdContainerTTY.prototype, "workingDir", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
Configurable(DTO.String().optional()),
|
|
164
|
+
__metadata("design:type", String)
|
|
165
|
+
], ContainerdContainerTTY.prototype, "user", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
Accept(ContainerTTYConsoleSizeOptions.required()),
|
|
168
|
+
__metadata("design:type", Function),
|
|
169
|
+
__metadata("design:paramtypes", [ContainerTTYConsoleSizeOptions]),
|
|
170
|
+
__metadata("design:returntype", Promise)
|
|
171
|
+
], ContainerdContainerTTY.prototype, "resize", null);
|
|
172
|
+
ContainerdContainerTTY = __decorate([
|
|
173
|
+
Transient()
|
|
174
|
+
], ContainerdContainerTTY);
|
|
175
|
+
export { ContainerdContainerTTY };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { InvalidValueException } from '@lakutata/core';
|
|
2
|
+
import { ContainerdImageNotFoundException } from '../exceptions/ContainerdImageNotFoundException.js';
|
|
3
|
+
import { ContainerdPlatformException } from '../exceptions/ContainerdPlatformException.js';
|
|
4
|
+
import { ContainerdContainerNameConflictException } from '../exceptions/ContainerdContainerNameConflictException.js';
|
|
5
|
+
import { ContainerdContainerStateException } from '../exceptions/ContainerdContainerStateException.js';
|
|
6
|
+
import { ContainerdNetworkNotFoundException } from '../exceptions/ContainerdNetworkNotFoundException.js';
|
|
7
|
+
import { ContainerdPathNotFoundException } from '../exceptions/ContainerdPathNotFoundException.js';
|
|
8
|
+
/**
|
|
9
|
+
* The exception of an error of the client (by its code), or the one given
|
|
10
|
+
* @param error
|
|
11
|
+
* @param fallback the exception of the operation
|
|
12
|
+
*/
|
|
13
|
+
export function containerdError(error, fallback) {
|
|
14
|
+
const message = error?.message ?? String(error);
|
|
15
|
+
switch (error?.code) {
|
|
16
|
+
case 'NOT_FOUND':
|
|
17
|
+
return new ContainerdImageNotFoundException(message);
|
|
18
|
+
case 'PLATFORM':
|
|
19
|
+
return new ContainerdPlatformException(message);
|
|
20
|
+
case 'CONFLICT':
|
|
21
|
+
return new ContainerdContainerNameConflictException(message);
|
|
22
|
+
case 'NETWORK_NOT_FOUND':
|
|
23
|
+
return new ContainerdNetworkNotFoundException(message);
|
|
24
|
+
case 'INVALID_VALUE':
|
|
25
|
+
return new InvalidValueException(message);
|
|
26
|
+
case 'PATH_NOT_FOUND':
|
|
27
|
+
return new ContainerdPathNotFoundException(message);
|
|
28
|
+
case 'RUNNING':
|
|
29
|
+
case 'NOT_RUNNING':
|
|
30
|
+
case 'PAUSED':
|
|
31
|
+
return new ContainerdContainerStateException(message);
|
|
32
|
+
}
|
|
33
|
+
return fallback ? new fallback(message) : error;
|
|
34
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Provider, DTO } from '@lakutata/core';
|
|
11
|
+
import { Transient, Configurable } from '@lakutata/core/decorator/di';
|
|
12
|
+
import { Accept } from '@lakutata/core/decorator/dto';
|
|
13
|
+
import { Time } from '@lakutata/utils/Time';
|
|
14
|
+
import { formatPlatform, parsePlatform } from '../../client/Platforms.js';
|
|
15
|
+
import { parseReference } from '../../client/Reference.js';
|
|
16
|
+
import { ImagePushOptions } from '../options/image/ImagePushOptions.js';
|
|
17
|
+
import { ImageExportOptions } from '../options/image/ImageExportOptions.js';
|
|
18
|
+
import { ContainerdImagePushException } from '../exceptions/ContainerdImagePushException.js';
|
|
19
|
+
import { ContainerdImageExportException } from '../exceptions/ContainerdImageExportException.js';
|
|
20
|
+
import { containerdError } from './ContainerdErrors.js';
|
|
21
|
+
/**
|
|
22
|
+
* An image of the {@link Containerd} component's namespace: its name, digest, platforms, size and configuration, and
|
|
23
|
+
* the operations tag, push, export and remove. Get it from {@link Containerd.getImage}, {@link Containerd.listImages},
|
|
24
|
+
* {@link Containerd.pullImage}, {@link Containerd.buildImage}, {@link Containerd.importImage} or
|
|
25
|
+
* {@link ContainerdContainer.commit}; do not create it yourself. Each call returns a new object (transient).
|
|
26
|
+
*
|
|
27
|
+
* An image may hold several platforms (an index): the object describes one of them, the first one the machine runs
|
|
28
|
+
* ({@link Containerd.supportedPlatforms}), or the first one present. Its properties are a snapshot taken when it was
|
|
29
|
+
* obtained; {@link ContainerdImage.syncImageInfo} takes a new one.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import {type Containerd, type ContainerdImage} from 'lakutata/com/containerd'
|
|
33
|
+
*
|
|
34
|
+
* declare const containerd: Containerd
|
|
35
|
+
*
|
|
36
|
+
* const image: ContainerdImage = await containerd.pullImage({image: 'alpine:3.20', platform: ['linux/amd64', 'linux/arm64']})
|
|
37
|
+
* //docker.io/library/alpine:3.20, its platforms, the command its containers run
|
|
38
|
+
* console.log(image.name, image.platforms, image.config.cmd)
|
|
39
|
+
* const tagged: ContainerdImage = await image.tag('registry.example.com/team/alpine:3.20')
|
|
40
|
+
* await tagged.push({auth: {username: 'deploy', password: 'secret'}})
|
|
41
|
+
* //An archive loaded by docker load and nerdctl load
|
|
42
|
+
* await image.export({destination: '/tmp/alpine.tar'})
|
|
43
|
+
* await tagged.remove()
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
let ContainerdImage = class ContainerdImage extends Provider {
|
|
47
|
+
/**
|
|
48
|
+
* Read the image's information.
|
|
49
|
+
* @throws {ContainerdImageNotFoundException} The image does not exist.
|
|
50
|
+
* @throws {ContainerdPlatformException} The content of none of its platforms is present.
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
async init() {
|
|
54
|
+
await this.syncImageInfo();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read the image's information again from containerd into the object's properties.
|
|
58
|
+
* @throws {ContainerdImageNotFoundException} The image no longer exists.
|
|
59
|
+
* @throws {ContainerdPlatformException} The content of none of its platforms is present.
|
|
60
|
+
*/
|
|
61
|
+
async syncImageInfo() {
|
|
62
|
+
const store = this.getStore();
|
|
63
|
+
let resolved;
|
|
64
|
+
let platforms;
|
|
65
|
+
try {
|
|
66
|
+
platforms = await store.platforms(this.name);
|
|
67
|
+
const supported = this.getContainerd().supportedPlatforms();
|
|
68
|
+
const preferred = platforms.find((platform) => supported.includes(formatPlatform(platform))) ?? platforms[0];
|
|
69
|
+
resolved = await store.resolve(this.name, preferred);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw containerdError(error);
|
|
73
|
+
}
|
|
74
|
+
const image = resolved.image;
|
|
75
|
+
const config = resolved.config.config ?? {};
|
|
76
|
+
this.name = image.name;
|
|
77
|
+
this.digest = image.target.digest;
|
|
78
|
+
this.mediaType = image.target.mediaType;
|
|
79
|
+
this.labels = image.labels ?? {};
|
|
80
|
+
this.createdAt = new Time(timestampMilliseconds(image.createdAt));
|
|
81
|
+
this.updatedAt = new Time(timestampMilliseconds(image.updatedAt));
|
|
82
|
+
this.platforms = platforms.map(formatPlatform);
|
|
83
|
+
this.platform = formatPlatform(resolved.platform);
|
|
84
|
+
this.os = resolved.platform.os;
|
|
85
|
+
this.arch = resolved.platform.architecture;
|
|
86
|
+
this.variant = resolved.platform.variant;
|
|
87
|
+
this.size = Number(resolved.manifest.config.size) + resolved.manifest.layers.reduce((size, layer) => size + Number(layer.size), 0);
|
|
88
|
+
this.config = {
|
|
89
|
+
env: Object.fromEntries((config.Env ?? []).map((entry) => [entry.split('=')[0], entry.slice(entry.indexOf('=') + 1)])),
|
|
90
|
+
cmd: config.Cmd ?? [],
|
|
91
|
+
entrypoint: config.Entrypoint ?? [],
|
|
92
|
+
workingDir: config.WorkingDir ?? '',
|
|
93
|
+
user: config.User ?? '',
|
|
94
|
+
exposedPorts: Object.keys(config.ExposedPorts ?? {}).map((key) => {
|
|
95
|
+
const [port, type] = key.split('/');
|
|
96
|
+
return { port: Number(port), type: (type ?? 'tcp') };
|
|
97
|
+
}),
|
|
98
|
+
volumes: Object.keys(config.Volumes ?? {}),
|
|
99
|
+
labels: config.Labels ?? {},
|
|
100
|
+
stopSignal: config.StopSignal
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Give the image another name, as `docker tag` does: a new image record with the same content. An image that has
|
|
105
|
+
* this name already is replaced. This object keeps its name.
|
|
106
|
+
* @param name The new name or reference (`registry.example.com/team/alpine:3.20`), normalized as Docker does.
|
|
107
|
+
* @returns The image under its new name.
|
|
108
|
+
* @throws {ContainerdImageNotFoundException} The image no longer exists.
|
|
109
|
+
*/
|
|
110
|
+
async tag(name) {
|
|
111
|
+
try {
|
|
112
|
+
return await this.getContainerd().getImage(await this.getStore().tag(this.name, name));
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
throw containerdError(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Push the image to its registry, or to another reference. With `platform`, only the manifest of that platform is
|
|
120
|
+
* pushed under the tag. Without it, when the content of all the platforms of its index is present, all of them and
|
|
121
|
+
* the index are pushed; otherwise only the manifest of the machine's platform. The credentials are `auth`, else the
|
|
122
|
+
* component's `registryAuths`. The push is aborted when the component is destroyed.
|
|
123
|
+
* @param options The `reference` to push to (the image's name by default), the `platform`, the credentials and the
|
|
124
|
+
* progress callback.
|
|
125
|
+
* @throws {ContainerdImageNotFoundException} The image no longer exists.
|
|
126
|
+
* @throws {ContainerdPlatformException} The platform to push (`platform`, or the machine's when only some platforms
|
|
127
|
+
* are present) is not present.
|
|
128
|
+
* @throws {ContainerdImagePushException} The registry cannot be reached or refuses the push (credentials, rights).
|
|
129
|
+
*/
|
|
130
|
+
async push(options) {
|
|
131
|
+
if (!options)
|
|
132
|
+
return await this.push({});
|
|
133
|
+
const registry = this.getRegistryOptions();
|
|
134
|
+
try {
|
|
135
|
+
await this.getStore().push(this.name, {
|
|
136
|
+
reference: options.reference,
|
|
137
|
+
platform: options.platform ? parsePlatform(options.platform) : undefined,
|
|
138
|
+
registry: options.auth ? { ...registry, credentials: { ...registry.credentials, [parseReference(options.reference ?? this.name).registry]: options.auth } } : registry,
|
|
139
|
+
progress: options.progressCallback
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw containerdError(error, ContainerdImagePushException);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Export the image into an archive: an OCI image layout with the `manifest.json` of `docker load`, loaded by
|
|
148
|
+
* `docker load`, `nerdctl load` and {@link Containerd.importImage}.
|
|
149
|
+
* @param options The destination: a file path (created or replaced) or a writable stream.
|
|
150
|
+
* @throws {ContainerdImageNotFoundException} The image no longer exists.
|
|
151
|
+
* @throws {ContainerdImageExportException} The archive cannot be written.
|
|
152
|
+
*/
|
|
153
|
+
async export(options) {
|
|
154
|
+
try {
|
|
155
|
+
await this.getStore().export([this.name], options.destination);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
throw containerdError(error, ContainerdImageExportException);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Remove the image's name. Its content and snapshots are collected by containerd once no other image and no
|
|
163
|
+
* container uses them; the containers of the image keep working.
|
|
164
|
+
* @throws {ContainerdImageNotFoundException} The image no longer exists.
|
|
165
|
+
*/
|
|
166
|
+
async remove() {
|
|
167
|
+
try {
|
|
168
|
+
await this.getStore().remove(this.name);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw containerdError(error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
__decorate([
|
|
176
|
+
Configurable(DTO.Function()),
|
|
177
|
+
__metadata("design:type", Function)
|
|
178
|
+
], ContainerdImage.prototype, "getStore", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
Configurable(DTO.Function()),
|
|
181
|
+
__metadata("design:type", Function)
|
|
182
|
+
], ContainerdImage.prototype, "getContainerd", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
Configurable(DTO.Function()),
|
|
185
|
+
__metadata("design:type", Function)
|
|
186
|
+
], ContainerdImage.prototype, "getRegistryOptions", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
Configurable(DTO.String()),
|
|
189
|
+
__metadata("design:type", String)
|
|
190
|
+
], ContainerdImage.prototype, "name", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
Accept(DTO.String().required()),
|
|
193
|
+
__metadata("design:type", Function),
|
|
194
|
+
__metadata("design:paramtypes", [String]),
|
|
195
|
+
__metadata("design:returntype", Promise)
|
|
196
|
+
], ContainerdImage.prototype, "tag", null);
|
|
197
|
+
__decorate([
|
|
198
|
+
Accept(ImagePushOptions.optional()),
|
|
199
|
+
__metadata("design:type", Function),
|
|
200
|
+
__metadata("design:paramtypes", [ImagePushOptions]),
|
|
201
|
+
__metadata("design:returntype", Promise)
|
|
202
|
+
], ContainerdImage.prototype, "push", null);
|
|
203
|
+
__decorate([
|
|
204
|
+
Accept(ImageExportOptions.required()),
|
|
205
|
+
__metadata("design:type", Function),
|
|
206
|
+
__metadata("design:paramtypes", [ImageExportOptions]),
|
|
207
|
+
__metadata("design:returntype", Promise)
|
|
208
|
+
], ContainerdImage.prototype, "export", null);
|
|
209
|
+
ContainerdImage = __decorate([
|
|
210
|
+
Transient()
|
|
211
|
+
], ContainerdImage);
|
|
212
|
+
export { ContainerdImage };
|
|
213
|
+
/**
|
|
214
|
+
* The milliseconds of a Timestamp
|
|
215
|
+
* @param timestamp
|
|
216
|
+
*/
|
|
217
|
+
function timestampMilliseconds(timestamp) {
|
|
218
|
+
return timestamp ? Number(timestamp.seconds ?? 0) * 1000 + Math.floor(Number(timestamp.nanos ?? 0) / 1e6) : Date.now();
|
|
219
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { DTO } from '@lakutata/core';
|
|
11
|
+
import { Expect } from '@lakutata/core/decorator/dto';
|
|
12
|
+
/**
|
|
13
|
+
* What {@link Containerd.prune} removes; every field is optional. A resource whose removal fails is skipped. Unlike the
|
|
14
|
+
* Docker component's options, the volumes are kept by default, and `allImages` removes the tagged images too.
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import {Containerd} from 'lakutata/com/containerd'
|
|
18
|
+
*
|
|
19
|
+
* declare const containerd: Containerd
|
|
20
|
+
*
|
|
21
|
+
* //The stopped containers and the dangling images (the defaults), and the unused volumes with their data
|
|
22
|
+
* const removed = await containerd.prune({volumes: true})
|
|
23
|
+
* console.log(removed.containers, removed.images, removed.volumes)
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class ContainerdPruneOptions extends DTO {
|
|
27
|
+
}
|
|
28
|
+
__decorate([
|
|
29
|
+
Expect(DTO.Boolean().optional().default(true)),
|
|
30
|
+
__metadata("design:type", Boolean)
|
|
31
|
+
], ContainerdPruneOptions.prototype, "containers", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
Expect(DTO.Boolean().optional().default(true)),
|
|
34
|
+
__metadata("design:type", Boolean)
|
|
35
|
+
], ContainerdPruneOptions.prototype, "images", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
Expect(DTO.Boolean().optional().default(false)),
|
|
38
|
+
__metadata("design:type", Boolean)
|
|
39
|
+
], ContainerdPruneOptions.prototype, "allImages", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
Expect(DTO.Boolean().optional().default(false)),
|
|
42
|
+
__metadata("design:type", Boolean)
|
|
43
|
+
], ContainerdPruneOptions.prototype, "networks", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Expect(DTO.Boolean().optional().default(false)),
|
|
46
|
+
__metadata("design:type", Boolean)
|
|
47
|
+
], ContainerdPruneOptions.prototype, "volumes", void 0);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { DTO } from '@lakutata/core';
|
|
11
|
+
import { Expect } from '@lakutata/core/decorator/dto';
|
|
12
|
+
/**
|
|
13
|
+
* The credentials of a container registry, given to a pull, a push or a build (their `auth` option) for the registry
|
|
14
|
+
* of the reference they name. They replace, for that operation, the ones the component's `registryAuths` option gives
|
|
15
|
+
* that registry. Every field is optional; without `username` nor `identityToken`, the registry is accessed anonymously.
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import {Containerd} from 'lakutata/com/containerd'
|
|
19
|
+
*
|
|
20
|
+
* declare const containerd: Containerd
|
|
21
|
+
*
|
|
22
|
+
* await containerd.pullImage({
|
|
23
|
+
* image: 'registry.example.com:5000/team/app:1.0',
|
|
24
|
+
* auth: {username: 'ci', password: process.env.REGISTRY_TOKEN ?? ''}
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export class ContainerdRegistryAuthOptions extends DTO {
|
|
29
|
+
}
|
|
30
|
+
__decorate([
|
|
31
|
+
Expect(DTO.String().optional()),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], ContainerdRegistryAuthOptions.prototype, "username", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
Expect(DTO.String().optional()),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], ContainerdRegistryAuthOptions.prototype, "password", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
Expect(DTO.String().optional()),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ContainerdRegistryAuthOptions.prototype, "identityToken", void 0);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { DTO } from '@lakutata/core';
|
|
11
|
+
import { Expect } from '@lakutata/core/decorator/dto';
|
|
12
|
+
/**
|
|
13
|
+
* How {@link ContainerdContainer.commit} saves a container's file system changes as a new image: one layer on its
|
|
14
|
+
* image, for the container's platform, with the image configuration changed as asked; the image is unpacked so it can
|
|
15
|
+
* run at once. Every field is optional. Unlike the Docker component's options, the image configuration can be changed
|
|
16
|
+
* and the commit commented, and an image committed without `repoTag` is still named.
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import {Containerd} from 'lakutata/com/containerd'
|
|
20
|
+
*
|
|
21
|
+
* declare const containerd: Containerd
|
|
22
|
+
*
|
|
23
|
+
* const container = await containerd.getContainer('builder')
|
|
24
|
+
* const image = await container.commit({
|
|
25
|
+
* repoTag: 'registry.example.com/app:1.1',
|
|
26
|
+
* changes: {cmd: ['node', 'server.js'], env: {NODE_ENV: 'production'}, exposedPorts: ['3000/tcp']},
|
|
27
|
+
* comment: 'Dependencies installed',
|
|
28
|
+
* author: 'CI <ci@example.com>'
|
|
29
|
+
* })
|
|
30
|
+
* console.log(image.name, image.digest)
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export class ContainerCommitOptions extends DTO {
|
|
34
|
+
}
|
|
35
|
+
__decorate([
|
|
36
|
+
Expect(DTO.String().optional()),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ContainerCommitOptions.prototype, "repoTag", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Expect(DTO.Boolean().optional().default(true)),
|
|
41
|
+
__metadata("design:type", Boolean)
|
|
42
|
+
], ContainerCommitOptions.prototype, "pauseBeforeCommitting", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Expect(DTO.Object({
|
|
45
|
+
cmd: DTO.Array(DTO.String()).optional(),
|
|
46
|
+
entrypoint: DTO.Array(DTO.String()).optional(),
|
|
47
|
+
env: DTO.Object().pattern(DTO.String(), DTO.String().allow('')).optional(),
|
|
48
|
+
workingDir: DTO.String().optional(),
|
|
49
|
+
user: DTO.String().optional(),
|
|
50
|
+
labels: DTO.Object().pattern(DTO.String(), DTO.String().allow('')).optional(),
|
|
51
|
+
exposedPorts: DTO.Array(DTO.String().pattern(/^\d+(\/(tcp|udp|sctp))?$/)).optional()
|
|
52
|
+
}).optional()),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], ContainerCommitOptions.prototype, "changes", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
Expect(DTO.String().optional()),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], ContainerCommitOptions.prototype, "comment", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Expect(DTO.String().optional()),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], ContainerCommitOptions.prototype, "author", void 0);
|