@lakutata/containerd 0.0.0-stage → 3.0.0-beta.1
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
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Lakutata
|
|
4
|
+
|
|
5
|
+
All rights reserved
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,410 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lakutata/containerd
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The containerd component of the lakutata framework: it manages the images, containers, CNI networks and named volumes
|
|
4
|
+
of a [containerd](https://containerd.io) namespace by talking to containerd's gRPC socket directly, without a Docker
|
|
5
|
+
daemon and without nerdctl (the gRPC client is written in TypeScript: no native addon). It targets the Linux machines
|
|
6
|
+
running containerd alone, such as embedded devices, with an API following the Docker component's: images pulled with
|
|
7
|
+
registry credentials, pushed, tagged, imported, exported and pruned; containers created with ports, volumes, devices,
|
|
8
|
+
seccomp and resource limits, then started, stopped, executed in, followed, measured, updated, committed and copied
|
|
9
|
+
from; builds sent to BuildKit. The containers it creates are nerdctl's, so `nerdctl ps` lists them. The umbrella
|
|
10
|
+
package `lakutata` re-exports it as `lakutata/com/containerd`.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
npm install lakutata
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The component has no optional npm dependency. The machine needs:
|
|
19
|
+
|
|
20
|
+
| Feature | Needs |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Everything | Linux, containerd 1.6 or later with runc (tested with 1.6, 1.7 and 2.4), Node.js 22 or later; the application runs as root or as a member of the group owning containerd's socket |
|
|
23
|
+
| CNI networks, published ports | The CNI plugins (`bridge`, `portmap`, `host-local`… in `/opt/cni/bin`, `/usr/lib/cni` or `/usr/libexec/cni`) and iptables |
|
|
24
|
+
| `exec()` with `stdin`, separate `stdout`/`stderr`, terminals | `mkfifo` on the host (without it, `exec()` puts both outputs in `stdout`) |
|
|
25
|
+
| Builds | A BuildKit daemon (`buildkitd`): local, on its unix socket, or remote over TCP/TLS |
|
|
26
|
+
| Containers of other architectures | QEMU (or Rosetta) emulators registered in `binfmt_misc` |
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### The component in an application
|
|
31
|
+
|
|
32
|
+
Register `Containerd` in the `components` of the application and get it with `getObject()` or `@Inject`. It connects
|
|
33
|
+
when it is created: without containerd on `socketPath`, the application fails to start with
|
|
34
|
+
`ContainerdConnectionException`. Its namespace is created when it does not exist.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import {Application} from 'lakutata'
|
|
38
|
+
import {Containerd, type ContainerdContainer, type ContainerdExecResult, type ContainerdImage} from 'lakutata/com/containerd'
|
|
39
|
+
|
|
40
|
+
Application
|
|
41
|
+
.run(() => ({
|
|
42
|
+
id: 'device.app',
|
|
43
|
+
name: 'Device',
|
|
44
|
+
components: {
|
|
45
|
+
containerd: {
|
|
46
|
+
class: Containerd,
|
|
47
|
+
//The defaults
|
|
48
|
+
socketPath: '/run/containerd/containerd.sock',
|
|
49
|
+
namespace: 'default',
|
|
50
|
+
snapshotter: 'overlayfs',
|
|
51
|
+
//systemd when containerd runs runc with SystemdCgroup = true
|
|
52
|
+
cgroupManager: 'cgroupfs',
|
|
53
|
+
//The containers' logs, hosts, resolv.conf, settings, and the named volumes
|
|
54
|
+
dataRoot: '/var/lib/lakutata/containerd',
|
|
55
|
+
//A container's log file rotated beyond 10 MiB when the component starts it (0: never)
|
|
56
|
+
logMaxSize: 10 * 1024 * 1024,
|
|
57
|
+
registryAuths: {'registry.example.com': {username: 'deploy', password: 'secret'}},
|
|
58
|
+
insecureRegistries: ['localhost:5000']
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
bootstrap: ['containerd']
|
|
62
|
+
}))
|
|
63
|
+
.onLaunched(async (app: Application): Promise<void> => {
|
|
64
|
+
const containerd: Containerd = await app.getObject('containerd')
|
|
65
|
+
console.log(await containerd.version())
|
|
66
|
+
const image: ContainerdImage = await containerd.pullImage({image: 'alpine:3.20'})
|
|
67
|
+
const container: ContainerdContainer = await containerd.createContainer({image: image.name, name: 'worker', cmd: ['sleep', 'infinity']})
|
|
68
|
+
await container.start()
|
|
69
|
+
const result: ContainerdExecResult = await container.exec({cmd: 'cat /etc/os-release'})
|
|
70
|
+
console.log(result.stdout)
|
|
71
|
+
await container.remove({force: true})
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### What differs from the Docker component
|
|
76
|
+
|
|
77
|
+
- No daemon in between: the component itself pulls, unpacks, pushes, imports and exports the images, and generates the
|
|
78
|
+
containers' OCI specifications, as nerdctl does. The containers carry nerdctl's labels (`nerdctl/name`…), and the
|
|
79
|
+
CNI network configurations are nerdctl's (`nerdctl-<name>.conflist`): nerdctl and the component share them.
|
|
80
|
+
- A container's output is written to a log file by containerd's shim, and its restart policy is applied by containerd's
|
|
81
|
+
restart monitor: both keep working while the application is stopped. The logs have no timestamps.
|
|
82
|
+
- `createContainer()` takes the image in its options, and never pulls it: pull it first. As with Docker, the containers
|
|
83
|
+
join the default network `bridge` by default (a CNI network created when first used: the CNI plugins are needed, see
|
|
84
|
+
the installation), where their ports are published; `network: 'host'` gives them the host's network.
|
|
85
|
+
- There is no `loginRepository()`: the credentials are the `registryAuths` option, or the `auth` of each call.
|
|
86
|
+
- `importImage()` returns every image of the archive, and `prune()` returns what it removed.
|
|
87
|
+
- A namespace is the unit: the images, containers and volumes of the other namespaces are not seen.
|
|
88
|
+
|
|
89
|
+
### Images
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import {type Containerd, type ContainerdImage, type ContainerdPruneResult} from 'lakutata/com/containerd'
|
|
93
|
+
|
|
94
|
+
declare const containerd: Containerd
|
|
95
|
+
|
|
96
|
+
//Pulled for the machine's platform, unpacked into the snapshotter (only the platforms the machine runs are unpacked)
|
|
97
|
+
const image: ContainerdImage = await containerd.pullImage({
|
|
98
|
+
image: 'alpine:3.20',
|
|
99
|
+
progressCallback: (progress): void => console.log(progress)
|
|
100
|
+
})
|
|
101
|
+
//docker.io/library/alpine:3.20, ['linux/arm64/v8'], {env, cmd, entrypoint, workingDir, user, exposedPorts…}
|
|
102
|
+
console.log(image.name, image.platforms, image.config)
|
|
103
|
+
|
|
104
|
+
//Other platforms (or 'all'), the credentials of one pull
|
|
105
|
+
await containerd.pullImage({image: 'alpine:3.20', platform: ['linux/amd64', 'linux/arm/v7']})
|
|
106
|
+
await containerd.pullImage({image: 'registry.example.com/team/app:1.0', auth: {username: 'u', password: 'p'}})
|
|
107
|
+
|
|
108
|
+
//Tags and pushes: every platform present (with the index), or only the one given
|
|
109
|
+
const tagged: ContainerdImage = await image.tag('registry.example.com/team/alpine:3.20')
|
|
110
|
+
await tagged.push()
|
|
111
|
+
await tagged.push({reference: 'registry.example.com/team/alpine:3.20-arm64', platform: 'linux/arm64'})
|
|
112
|
+
|
|
113
|
+
//Archives: OCI image layouts with the manifest.json of docker load; docker save archives are imported too
|
|
114
|
+
await image.export({destination: '/tmp/alpine.tar'})
|
|
115
|
+
await containerd.exportImages(['alpine:3.20', 'busybox'], {destination: '/tmp/images.tar'})
|
|
116
|
+
const imported: ContainerdImage[] = await containerd.importImage({source: '/tmp/images.tar'})
|
|
117
|
+
console.log(imported.length, (await containerd.listImages()).length)
|
|
118
|
+
//Another name: only for an archive of one image
|
|
119
|
+
await containerd.importImage({source: '/tmp/alpine.tar', name: 'alpine:backup'})
|
|
120
|
+
|
|
121
|
+
await tagged.remove()
|
|
122
|
+
//The stopped containers and the dangling images (allImages: every image no container uses)
|
|
123
|
+
const pruned: ContainerdPruneResult = await containerd.prune({containers: true, images: true, allImages: false})
|
|
124
|
+
console.log(pruned.images)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The names are normalized as Docker does (`alpine` is `docker.io/library/alpine:latest`). containerd keeps an image's
|
|
128
|
+
content while an image or a container uses it. A multi-platform image is described for the first of its platforms
|
|
129
|
+
the machine runs.
|
|
130
|
+
|
|
131
|
+
### Containers
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import {type Containerd, type ContainerdContainer, type ContainerdContainerStats, type ContainerdExecResult, type ContainerdImage} from 'lakutata/com/containerd'
|
|
135
|
+
|
|
136
|
+
declare const containerd: Containerd
|
|
137
|
+
|
|
138
|
+
const container: ContainerdContainer = await containerd.createContainer({
|
|
139
|
+
image: 'alpine:3.20',
|
|
140
|
+
name: 'worker',
|
|
141
|
+
cmd: ['sh', '-c', 'while true; do date; sleep 1; done'],
|
|
142
|
+
env: {MODE: 'production'},
|
|
143
|
+
user: 'nobody',
|
|
144
|
+
labels: {app: 'worker'},
|
|
145
|
+
binds: [{hostPath: '/data/worker', containerPath: '/data'}],
|
|
146
|
+
volumes: [{volumeName: 'worker-cache', containerPath: '/cache'}],
|
|
147
|
+
tmpfs: [{containerPath: '/tmp', size: 16 * 1024 * 1024}],
|
|
148
|
+
//A device, and the USB serial ports plugged later (major 188)
|
|
149
|
+
devices: [{hostPath: '/dev/ttyUSB0'}],
|
|
150
|
+
deviceCgroupRules: ['c 188:* rwm'],
|
|
151
|
+
//And as much swap (memorySwap: twice the memory by default, -1 unlimited)
|
|
152
|
+
memoryLimit: 128 * 1024 * 1024,
|
|
153
|
+
cpus: 0.5,
|
|
154
|
+
restartPolicy: 'always'
|
|
155
|
+
})
|
|
156
|
+
await container.start()
|
|
157
|
+
console.log(container.state.status, container.state.pid)
|
|
158
|
+
|
|
159
|
+
//A string runs through /bin/sh -c; the outputs are captured in memory
|
|
160
|
+
const result: ContainerdExecResult = await container.exec({cmd: 'cat /etc/os-release', user: 'root', timeout: 5000})
|
|
161
|
+
console.log(result.exitCode, result.stdout, result.stderr)
|
|
162
|
+
await container.exec({cmd: ['sh', '-c', 'cat > /data/input'], stdin: 'content'})
|
|
163
|
+
|
|
164
|
+
//The last 100 lines; follow (the default) keeps the stream open while the container runs
|
|
165
|
+
for await (const chunk of await container.logs({tail: 100, follow: false})) process.stdout.write(chunk)
|
|
166
|
+
|
|
167
|
+
const stats: ContainerdContainerStats = await container.stats()
|
|
168
|
+
console.log(stats.cpu.percent, stats.memory.usage, stats.pids.current)
|
|
169
|
+
|
|
170
|
+
//Resources and restart policy: live (0 removes a limit); any other setting: the container created again, its name kept
|
|
171
|
+
await container.update({memoryLimit: 256 * 1024 * 1024, restartPolicy: 'unless-stopped'})
|
|
172
|
+
await container.update({cpus: 0})
|
|
173
|
+
await container.update({env: {MODE: 'debug'}})
|
|
174
|
+
|
|
175
|
+
//Its changes as an image; a directory copied out as a tar archive
|
|
176
|
+
const patched: ContainerdImage = await container.commit({repoTag: 'worker:patched', changes: {cmd: ['date']}})
|
|
177
|
+
await container.exportDirectory({path: '/var/log', destination: '/tmp/logs.tar'})
|
|
178
|
+
console.log(patched.name, await container.processes())
|
|
179
|
+
|
|
180
|
+
await container.pause()
|
|
181
|
+
await container.unpause()
|
|
182
|
+
//Its stop signal, then SIGKILL after 10 seconds
|
|
183
|
+
await container.stop({timeout: 10})
|
|
184
|
+
//A container which is not running: its last exit code at once
|
|
185
|
+
console.log(await container.wait())
|
|
186
|
+
await container.remove()
|
|
187
|
+
|
|
188
|
+
console.log(await containerd.listContainers({app: 'worker'}))
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- The containers get containerd's default seccomp profile, with the system calls their `capabilities` allow (as
|
|
192
|
+
nerdctl does); `seccompProfile: 'unconfined'` disables it, and a file path gives an OCI profile. The privileged
|
|
193
|
+
containers are unconfined.
|
|
194
|
+
- `devices` creates the host's devices in the container (a device, or every device of a directory such as `/dev/snd`).
|
|
195
|
+
For the devices plugged later, bind their directory and allow their numbers with `deviceCgroupRules`, as Docker's
|
|
196
|
+
`--device-cgroup-rule` does. A `privileged` container gets every device of the host's `/dev` (as nerdctl gives
|
|
197
|
+
them).
|
|
198
|
+
- The containers have their own cgroup namespace on cgroup v2 (`cgroupns: 'host'` shares the host's).
|
|
199
|
+
- `privileged`, `capabilities`, `capabilitiesDrop`, `readonlyRootfs`, `pidMode: 'host'`, `ipcMode: 'host'`, `sysctls`,
|
|
200
|
+
`extraHosts`, `dns`, `shmSize`, `pidsLimit`, `cpuSet`, `cpuShares`, `memorySwap` and `OOMKillDisable` are Docker's
|
|
201
|
+
options of the same names. As with Docker, `memorySwap` is the memory and the swap together, needs `memoryLimit`,
|
|
202
|
+
and is twice `memoryLimit` by default.
|
|
203
|
+
- `update()` with other settings than the resources and the restart policy only works for the containers the component
|
|
204
|
+
created (it keeps their settings in `dataRoot`). A resource set to `0` (`cpuSet: []`) is removed at once, from the
|
|
205
|
+
running container too.
|
|
206
|
+
- `wait()` of a container which is not running resolves at once, as `docker wait` does: the exit code of its last run,
|
|
207
|
+
`0` when it was never started.
|
|
208
|
+
|
|
209
|
+
Terminals run a process with a pseudo terminal in a running container: `/bin/sh` by default; a string command runs
|
|
210
|
+
through `/bin/sh -c` as `exec()` runs it, an array as it is.
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import {type Containerd, type ContainerdContainer, type ContainerdContainerTTY} from 'lakutata/com/containerd'
|
|
214
|
+
|
|
215
|
+
declare const containerd: Containerd
|
|
216
|
+
|
|
217
|
+
const container: ContainerdContainer = await containerd.getContainer('worker')
|
|
218
|
+
const tty: ContainerdContainerTTY = await container.createTTY({consoleSize: {cols: 120, rows: 40}})
|
|
219
|
+
tty.onData((chunk: Buffer): void => {
|
|
220
|
+
process.stdout.write(chunk)
|
|
221
|
+
})
|
|
222
|
+
tty.write('ls\n')
|
|
223
|
+
await tty.resize({cols: 100, rows: 30})
|
|
224
|
+
//Or tty.raw, a duplex stream to pipe a socket into
|
|
225
|
+
await tty.close()
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Networks
|
|
229
|
+
|
|
230
|
+
Besides `host` and `none`, the containers join CNI networks: nerdctl's default `bridge` (`nerdctl0`, `10.4.0.0/24`,
|
|
231
|
+
created when first asked for; the network of the containers created without `network` nor `networks`) and the networks created, bridges, macvlans or ipvlans, with IPv4 and
|
|
232
|
+
IPv6 subnets. Each container's networks are set up by its runc hooks, so they also work when containerd restarts it
|
|
233
|
+
without the application.
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
import {type Containerd, type ContainerdContainer, type ContainerdNetworkInfo} from 'lakutata/com/containerd'
|
|
237
|
+
|
|
238
|
+
declare const containerd: Containerd
|
|
239
|
+
|
|
240
|
+
//A free subnet of 10.4.0.0/16 without subnet
|
|
241
|
+
const backend: ContainerdNetworkInfo = await containerd.createNetwork({name: 'backend', subnet: '10.4.10.0/24'})
|
|
242
|
+
await containerd.createNetwork({name: 'dual', subnet: '10.4.11.0/24', ipv6Subnet: 'fd00:4:11::/64'})
|
|
243
|
+
await containerd.createNetwork({name: 'lan', driver: 'macvlan', parent: 'eth0', subnet: '192.168.1.0/24', gateway: '192.168.1.1'})
|
|
244
|
+
|
|
245
|
+
const web: ContainerdContainer = await containerd.createContainer({
|
|
246
|
+
image: 'nginx:alpine',
|
|
247
|
+
//eth0 and eth1
|
|
248
|
+
networks: [{networkName: 'bridge'}, {networkName: backend.name, ip: '10.4.10.5'}],
|
|
249
|
+
//Published through the first network
|
|
250
|
+
ports: [{port: 80, hostPorts: [8080]}]
|
|
251
|
+
})
|
|
252
|
+
await web.start()
|
|
253
|
+
console.log(web.networks, web.ports)
|
|
254
|
+
|
|
255
|
+
await web.remove({force: true})
|
|
256
|
+
//Refused while a container uses it
|
|
257
|
+
await containerd.removeNetwork('backend')
|
|
258
|
+
console.log(await containerd.listNetworks())
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Volumes
|
|
262
|
+
|
|
263
|
+
Named volumes are directories under `dataRoot`, created when a container mounts them or by `createVolume()`.
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import {type Containerd, type ContainerdVolumeInfo} from 'lakutata/com/containerd'
|
|
267
|
+
|
|
268
|
+
declare const containerd: Containerd
|
|
269
|
+
|
|
270
|
+
const volume: ContainerdVolumeInfo = await containerd.createVolume({name: 'data', labels: {app: 'web'}})
|
|
271
|
+
console.log(volume.mountpoint)
|
|
272
|
+
await containerd.createContainer({image: 'alpine:3.20', volumes: [{volumeName: 'data', containerPath: '/var/lib/app'}]})
|
|
273
|
+
console.log(await containerd.listVolumes())
|
|
274
|
+
//The unused networks and volumes too
|
|
275
|
+
await containerd.prune({networks: true, volumes: true})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
`removeVolume()` refuses a volume that a container mounts, even a stopped one.
|
|
279
|
+
|
|
280
|
+
### Builds with BuildKit
|
|
281
|
+
|
|
282
|
+
`buildImage()` sends the build context (without the files its `.dockerignore` excludes) and the Dockerfile to BuildKit
|
|
283
|
+
over its session, as `docker buildx` does, then imports the image built into containerd. BuildKit is a local
|
|
284
|
+
`buildkitd` (its unix socket, with its containerd or runc worker) or a remote one over TCP, with TLS:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import {readFileSync} from 'node:fs'
|
|
288
|
+
import {Application} from 'lakutata'
|
|
289
|
+
import {Containerd, type ContainerdImage} from 'lakutata/com/containerd'
|
|
290
|
+
|
|
291
|
+
Application
|
|
292
|
+
.run(() => ({
|
|
293
|
+
id: 'builder.app',
|
|
294
|
+
name: 'Builder',
|
|
295
|
+
components: {
|
|
296
|
+
containerd: {
|
|
297
|
+
class: Containerd,
|
|
298
|
+
buildkitAddress: 'tcp://builder:1234',
|
|
299
|
+
buildkitTLS: {ca: readFileSync('ca.pem'), cert: readFileSync('cert.pem'), key: readFileSync('key.pem')}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}))
|
|
303
|
+
.onLaunched(async (app: Application): Promise<void> => {
|
|
304
|
+
const containerd: Containerd = await app.getObject('containerd')
|
|
305
|
+
console.log(await containerd.buildkitVersion(), await containerd.buildkitPlatforms())
|
|
306
|
+
const image: ContainerdImage = await containerd.buildImage({
|
|
307
|
+
workdir: '/srv/app',
|
|
308
|
+
dockerfile: 'docker/App.Dockerfile',
|
|
309
|
+
repoTag: 'registry.example.com/team/app:1.0',
|
|
310
|
+
buildargs: {NODE_ENV: 'production'},
|
|
311
|
+
//The machine's by default
|
|
312
|
+
platform: ['linux/arm64', 'linux/amd64'],
|
|
313
|
+
push: true,
|
|
314
|
+
outputCallback: (line: string): void => console.log(line)
|
|
315
|
+
})
|
|
316
|
+
console.log(image.platforms)
|
|
317
|
+
})
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
BuildKit pulls the base images with the component's registry credentials (or `auth`).
|
|
321
|
+
|
|
322
|
+
### Namespaces, platforms and events
|
|
323
|
+
|
|
324
|
+
Each component works in one namespace; register one component per namespace to manage several (`k8s.io` is the
|
|
325
|
+
Kubernetes one). `supportedPlatforms()` lists the platforms the machine runs: its own and the emulators registered in
|
|
326
|
+
`binfmt_misc`, so that a container of another architecture runs once its emulator is registered. `events()` streams
|
|
327
|
+
containerd's events of the namespace.
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
import {Application} from 'lakutata'
|
|
331
|
+
import {Containerd, type ContainerdContainer, type ContainerdEvent} from 'lakutata/com/containerd'
|
|
332
|
+
|
|
333
|
+
Application
|
|
334
|
+
.run(() => ({
|
|
335
|
+
id: 'events.app',
|
|
336
|
+
name: 'Events',
|
|
337
|
+
components: {
|
|
338
|
+
containerd: {class: Containerd},
|
|
339
|
+
kubernetes: {class: Containerd, namespace: 'k8s.io'}
|
|
340
|
+
}
|
|
341
|
+
}))
|
|
342
|
+
.onLaunched(async (app: Application): Promise<void> => {
|
|
343
|
+
const containerd: Containerd = await app.getObject('containerd')
|
|
344
|
+
console.log(containerd.supportedPlatforms())
|
|
345
|
+
await containerd.pullImage({image: 'alpine:3.20', platform: 'linux/amd64'})
|
|
346
|
+
const container: ContainerdContainer = await containerd.createContainer({image: 'alpine:3.20', platform: 'linux/amd64', cmd: ['uname', '-m']})
|
|
347
|
+
await container.start()
|
|
348
|
+
const abort: AbortController = new AbortController()
|
|
349
|
+
setTimeout((): void => abort.abort(), 60000)
|
|
350
|
+
for await (const event of containerd.events(abort.signal)) {
|
|
351
|
+
//{topic: '/tasks/exit', type: 'containerd.events.TaskExit', event: {containerId, exitStatus…}, namespace, timestamp}
|
|
352
|
+
const received: ContainerdEvent = event
|
|
353
|
+
console.log(received.topic, received.event)
|
|
354
|
+
}
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## API
|
|
359
|
+
|
|
360
|
+
| Export | What it is |
|
|
361
|
+
|---|---|
|
|
362
|
+
| `Containerd` | The component: `version`, `supportedPlatforms`, `detectPlatforms`, `events`; images (`listImages`, `getImage`, `pullImage`, `buildImage`, `buildkitVersion`, `buildkitPlatforms`, `importImage`, `exportImages`); networks (`listNetworks`, `getNetwork`, `createNetwork`, `removeNetwork`); containers (`listContainers`, `getContainer`, `createContainer`); volumes (`listVolumes`, `getVolume`, `createVolume`, `removeVolume`); `prune`. Its options: `socketPath`, `namespace`, `snapshotter`, `runtime`, `cgroupManager`, `dataRoot`, `logMaxSize`, `cniConfigPath`, `cniPath`, `buildkitAddress`, `buildkitTLS`, `registryAuths`, `insecureRegistries` |
|
|
363
|
+
| `ContainerdImage` | An image: `name`, `digest`, `platforms`, `platform`, `size`, `config`…; `tag`, `push`, `export`, `remove`, `syncImageInfo` |
|
|
364
|
+
| `ContainerdContainer` | A container: `id`, `name`, `state`, `networks`, `ports`, `volumes`…; `start`, `stop`, `restart`, `kill`, `pause`, `unpause`, `wait`, `remove`, `exec`, `logs`, `stats`, `createTTY`, `update`, `commit`, `exportDirectory`, `processes`, `image`, `syncContainerInfo` |
|
|
365
|
+
| `ContainerdContainerTTY` | A terminal in a container: `raw`, `readable`, `writable`, `onData`, `write`, `resize`, `wait`, `close` |
|
|
366
|
+
| `ImagePullOptions`, `ImagePushOptions`, `ImageBuildOptions`, `ImageImportOptions`, `ImageExportOptions` | The options of the image operations |
|
|
367
|
+
| `ContainerCreateOptions`, `ContainerStopOptions`, `ContainerKillOptions`, `ContainerRemoveOptions`, `ContainerExecOptions`, `ContainerLogsOptions`, `ContainerTTYOptions`, `ContainerTTYConsoleSizeOptions`, `ContainerResourceOptions`, `ContainerCommitOptions`, `ContainerExportDirectoryOptions` | The options of the container operations |
|
|
368
|
+
| `NetworkCreateOptions`, `VolumeCreateOptions`, `ContainerdPruneOptions`, `ContainerdRegistryAuthOptions` | The options of the networks, the volumes, `prune` and the registry credentials |
|
|
369
|
+
| `ContainerdBind`, `ContainerdVolume`, `ContainerdTmpfs`, `ContainerdDevice`, `ContainerdContainerPort`, `ContainerdRestartPolicy` | The parts of the container options |
|
|
370
|
+
| `ContainerdContainerState`, `ContainerdContainerNetwork`, `ContainerdContainerStats`, `ContainerdExecResult`, `ContainerdImageConfig`, `ContainerdNetworkInfo`, `ContainerdVolumeInfo`, `ContainerdPruneResult`, `ContainerdEvent` | The information returned |
|
|
371
|
+
| `ContainerdProgressCallback`, `ContainerdBuildOutputCallback` | The callbacks of the transfers and of the builds |
|
|
372
|
+
| `ContainerdConnectionException` and the other `Containerd*Exception` | The exceptions (see below) |
|
|
373
|
+
|
|
374
|
+
All are exported by `lakutata/com/containerd` and `@lakutata/containerd`. The typings document each declaration with
|
|
375
|
+
examples.
|
|
376
|
+
|
|
377
|
+
## Errors
|
|
378
|
+
|
|
379
|
+
| Exception | When |
|
|
380
|
+
|---|---|
|
|
381
|
+
| `ContainerdConnectionException` (`E_CONTAINERD_CONNECTION`) | The component is created and containerd does not answer on `socketPath` (not running, no access to the socket), or `buildkitTLS` is given with a unix socket `buildkitAddress` |
|
|
382
|
+
| `ContainerdImageNotFoundException` (`E_CONTAINERD_IMAGE_NOT_FOUND`) | No image has the name: `getImage()`, `createContainer()` of an image not pulled, an operation on an image removed |
|
|
383
|
+
| `ContainerdPlatformException` (`E_CONTAINERD_PLATFORM`) | The image has no manifest for the platform asked (pull, push, container creation) |
|
|
384
|
+
| `ContainerdImagePullException` (`E_CONTAINERD_IMAGE_PULL`) | The registry cannot be reached, refuses the credentials or does not have the reference; the transfer or the unpacking fails |
|
|
385
|
+
| `ContainerdImagePushException` (`E_CONTAINERD_IMAGE_PUSH`) | The registry cannot be reached or refuses the push |
|
|
386
|
+
| `ContainerdImageImportException` (`E_CONTAINERD_IMAGE_IMPORT`) | The archive cannot be read or has no image; a `name` is given with an archive of several images; the unpacking fails |
|
|
387
|
+
| `ContainerdImageExportException` (`E_CONTAINERD_IMAGE_EXPORT`) | The archive cannot be written |
|
|
388
|
+
| `ContainerdImageBuildException` (`E_CONTAINERD_IMAGE_BUILD`) | BuildKit cannot be reached, the build fails, or the image built cannot be imported |
|
|
389
|
+
| `ContainerdContainerNotFoundException` (`E_CONTAINERD_CONTAINER_NOT_FOUND`) | No container has the identifier, name or prefix |
|
|
390
|
+
| `ContainerdContainerNameConflictException` (`E_CONTAINERD_CONTAINER_NAME_CONFLICT`) | Another container has the name |
|
|
391
|
+
| `ContainerdContainerStateException` (`E_CONTAINERD_CONTAINER_STATE`) | `exec()`, `createTTY()`, `stats()`, `kill()`, `pause()`, `unpause()`, `processes()` on a container not running; `start()` on a paused one; `remove()` on a running one without `force`; an `update()` recreating a container the component did not create |
|
|
392
|
+
| `ContainerdPathNotFoundException` (`E_CONTAINERD_PATH_NOT_FOUND`) | `exportDirectory()` of a path missing from the container |
|
|
393
|
+
| `ContainerdNetworkNotFoundException` (`E_CONTAINERD_NETWORK_NOT_FOUND`) | No network has the name or identifier; a container created on a missing network |
|
|
394
|
+
| `ContainerdNetworkConflictException` (`E_CONTAINERD_NETWORK_CONFLICT`) | The network exists, its subnet overlaps another one, a container uses it, it is the default `bridge`, or nerdctl did not create it |
|
|
395
|
+
| `ContainerdVolumeNotFoundException` (`E_CONTAINERD_VOLUME_NOT_FOUND`) | The volume does not exist |
|
|
396
|
+
| `ContainerdVolumeInUseException` (`E_CONTAINERD_VOLUME_IN_USE`) | A container mounts the volume |
|
|
397
|
+
| `InvalidValueException` (from `lakutata`) | The component's options are invalid, when it is created; a live `update()` of a `memorySwap` without a memory limit, or below it |
|
|
398
|
+
| `InvalidMethodAcceptException` (from `lakutata`) | The arguments of a call do not match its options (a container name with a space, a missing `image`, a `memorySwap` without `memoryLimit`) |
|
|
399
|
+
| `GRPCError` (from `@lakutata/grpc`) | `wait()` aborted (the object destroyed); containerd lost |
|
|
400
|
+
| `Error` | The settings of a container cannot be applied (ports without a CNI network, no command, no CNI plugin, a user missing from the image); a container prefix matching several containers |
|
|
401
|
+
|
|
402
|
+
## See also
|
|
403
|
+
|
|
404
|
+
- `doc/en/ContainerdIntegration.md` of the package `lakutata` (Chinese in `doc/zh`): the guide of the component.
|
|
405
|
+
- `@lakutata/docker` (`lakutata/com/docker`): the same operations through a Docker daemon.
|
|
406
|
+
- `@lakutata/grpc`: the gRPC client the component and its builds use.
|
|
407
|
+
- `@lakutata/core` (`lakutata`): the components, `Application` and the dependency injection.
|
|
408
|
+
- `npm run test:engines` (in this package) runs the engine tests against containerd 1.6, 1.7 and 2.4 in privileged
|
|
409
|
+
Docker containers (`test-env/run.sh 2.4` for one version, `--build` to rebuild its image), with a local and a remote
|
|
410
|
+
BuildKit; see `test-env/README.md`.
|