@lakutata/docker 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +309 -0
- package/THIRD_PARTY_NOTICES.md +299 -0
- package/dist/cjs/client/BuildContext.d.ts +22 -0
- package/dist/cjs/client/BuildContext.js +76 -0
- package/dist/cjs/client/BuildKitProgress.d.ts +81 -0
- package/dist/cjs/client/BuildKitProgress.js +195 -0
- package/dist/cjs/client/DockerClient.d.ts +196 -0
- package/dist/cjs/client/DockerClient.js +312 -0
- package/dist/cjs/client/DockerConnection.d.ts +154 -0
- package/dist/cjs/client/DockerConnection.js +397 -0
- package/dist/cjs/client/DockerIgnore.d.ts +44 -0
- package/dist/cjs/client/DockerIgnore.js +186 -0
- package/dist/cjs/client/DockerRequestError.d.ts +17 -0
- package/dist/cjs/client/DockerRequestError.js +24 -0
- package/dist/cjs/client/DockerStreams.d.ts +35 -0
- package/dist/cjs/client/DockerStreams.js +117 -0
- package/dist/cjs/client/types/ContainerCreateResponse.d.ts +7 -0
- package/dist/cjs/client/types/ContainerCreateResponse.js +2 -0
- package/dist/cjs/client/types/ContainerStopQuery.d.ts +13 -0
- package/dist/cjs/client/types/ContainerStopQuery.js +2 -0
- package/dist/cjs/client/types/DeviceMapping.d.ts +8 -0
- package/dist/cjs/client/types/DeviceMapping.js +2 -0
- package/dist/cjs/client/types/IdResponse.d.ts +6 -0
- package/dist/cjs/client/types/IdResponse.js +2 -0
- package/dist/cjs/client/types/NetworkCreateResponse.d.ts +7 -0
- package/dist/cjs/client/types/NetworkCreateResponse.js +2 -0
- package/dist/cjs/client/types/PortBinding.d.ts +10 -0
- package/dist/cjs/client/types/PortBinding.js +2 -0
- package/dist/cjs/docker/ConnectionOptionsBuilder.d.ts +128 -0
- package/dist/cjs/docker/ConnectionOptionsBuilder.js +150 -0
- package/dist/cjs/docker/Docker.d.ts +301 -0
- package/dist/cjs/docker/Docker.js +703 -0
- package/dist/cjs/docker/exceptions/DockerConnectionException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerConnectionException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageBuildException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImageBuildException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageImportException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImageImportException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
- package/dist/cjs/docker/exceptions/DockerImageNotFoundException.js +17 -0
- package/dist/cjs/docker/exceptions/DockerImagePullException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerImagePullException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerImagePushException.d.ts +8 -0
- package/dist/cjs/docker/exceptions/DockerImagePushException.js +15 -0
- package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
- package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.js +15 -0
- package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
- package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.js +16 -0
- package/dist/cjs/docker/exceptions/DockerRequestException.d.ts +22 -0
- package/dist/cjs/docker/exceptions/DockerRequestException.js +24 -0
- package/dist/cjs/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
- package/dist/cjs/docker/interfaces/IDockerConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerKeyObject.d.ts +14 -0
- package/dist/cjs/docker/interfaces/IDockerKeyObject.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
- package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.js +2 -0
- package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
- package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.js +2 -0
- package/dist/cjs/docker/lib/DockerContainer.d.ts +315 -0
- package/dist/cjs/docker/lib/DockerContainer.js +742 -0
- package/dist/cjs/docker/lib/DockerContainerTTY.d.ts +99 -0
- package/dist/cjs/docker/lib/DockerContainerTTY.js +157 -0
- package/dist/cjs/docker/lib/DockerImage.d.ts +153 -0
- package/dist/cjs/docker/lib/DockerImage.js +273 -0
- package/dist/cjs/docker/lib/EngineSettings.d.ts +41 -0
- package/dist/cjs/docker/lib/EngineSettings.js +86 -0
- package/dist/cjs/docker/lib/ParseBaseImages.d.ts +9 -0
- package/dist/cjs/docker/lib/ParseBaseImages.js +50 -0
- package/dist/cjs/docker/lib/ParseEnvToRecord.d.ts +14 -0
- package/dist/cjs/docker/lib/ParseEnvToRecord.js +25 -0
- package/dist/cjs/docker/lib/ParseRepositoryTag.d.ts +17 -0
- package/dist/cjs/docker/lib/ParseRepositoryTag.js +48 -0
- package/dist/cjs/docker/lib/RegistryAuth.d.ts +8 -0
- package/dist/cjs/docker/lib/RegistryAuth.js +15 -0
- package/dist/cjs/docker/options/DockerPruneOptions.d.ts +38 -0
- package/dist/cjs/docker/options/DockerPruneOptions.js +47 -0
- package/dist/cjs/docker/options/auth/DockerAuthOptions.d.ts +46 -0
- package/dist/cjs/docker/options/auth/DockerAuthOptions.js +59 -0
- package/dist/cjs/docker/options/container/ContainerCommitOptions.d.ts +28 -0
- package/dist/cjs/docker/options/container/ContainerCommitOptions.js +39 -0
- package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
- package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.js +43 -0
- package/dist/cjs/docker/options/container/ContainerExecOptions.d.ts +26 -0
- package/dist/cjs/docker/options/container/ContainerExecOptions.js +38 -0
- package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
- package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.js +39 -0
- package/dist/cjs/docker/options/container/ContainerKillOptions.d.ts +25 -0
- package/dist/cjs/docker/options/container/ContainerKillOptions.js +36 -0
- package/dist/cjs/docker/options/container/ContainerLogsOptions.d.ts +48 -0
- package/dist/cjs/docker/options/container/ContainerLogsOptions.js +56 -0
- package/dist/cjs/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/cjs/docker/options/container/ContainerRemoveOptions.js +34 -0
- package/dist/cjs/docker/options/container/ContainerSettingOptions.d.ts +137 -0
- package/dist/cjs/docker/options/container/ContainerSettingOptions.js +136 -0
- package/dist/cjs/docker/options/container/ContainerStopOptions.d.ts +28 -0
- package/dist/cjs/docker/options/container/ContainerStopOptions.js +40 -0
- package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
- package/dist/cjs/docker/options/image/ImageBuildOptions.d.ts +117 -0
- package/dist/cjs/docker/options/image/ImageBuildOptions.js +111 -0
- package/dist/cjs/docker/options/image/ImageExportOptions.d.ts +33 -0
- package/dist/cjs/docker/options/image/ImageExportOptions.js +44 -0
- package/dist/cjs/docker/options/image/ImageImportOptions.d.ts +28 -0
- package/dist/cjs/docker/options/image/ImageImportOptions.js +42 -0
- package/dist/cjs/docker/options/image/ImagePullOptions.d.ts +49 -0
- package/dist/cjs/docker/options/image/ImagePullOptions.js +63 -0
- package/dist/cjs/docker/options/image/ImagePushOptions.d.ts +41 -0
- package/dist/cjs/docker/options/image/ImagePushOptions.js +56 -0
- package/dist/cjs/docker/options/image/ImageRemoveOptions.d.ts +26 -0
- package/dist/cjs/docker/options/image/ImageRemoveOptions.js +38 -0
- package/dist/cjs/docker/options/image/ImageTagOptions.d.ts +25 -0
- package/dist/cjs/docker/options/image/ImageTagOptions.js +38 -0
- package/dist/cjs/docker/options/network/NetworkCreateOptions.d.ts +54 -0
- package/dist/cjs/docker/options/network/NetworkCreateOptions.js +63 -0
- package/dist/cjs/docker/types/ContainerBind.d.ts +19 -0
- package/dist/cjs/docker/types/ContainerBind.js +2 -0
- package/dist/cjs/docker/types/ContainerCapability.d.ts +286 -0
- package/dist/cjs/docker/types/ContainerCapability.js +290 -0
- package/dist/cjs/docker/types/ContainerConfig.d.ts +67 -0
- package/dist/cjs/docker/types/ContainerConfig.js +2 -0
- package/dist/cjs/docker/types/ContainerDevice.d.ts +19 -0
- package/dist/cjs/docker/types/ContainerDevice.js +2 -0
- package/dist/cjs/docker/types/ContainerExecResult.d.ts +20 -0
- package/dist/cjs/docker/types/ContainerExecResult.js +2 -0
- package/dist/cjs/docker/types/ContainerNetwork.d.ts +46 -0
- package/dist/cjs/docker/types/ContainerNetwork.js +2 -0
- package/dist/cjs/docker/types/ContainerPort.d.ts +25 -0
- package/dist/cjs/docker/types/ContainerPort.js +2 -0
- package/dist/cjs/docker/types/ContainerRestartPolicy.d.ts +11 -0
- package/dist/cjs/docker/types/ContainerRestartPolicy.js +2 -0
- package/dist/cjs/docker/types/ContainerState.d.ts +48 -0
- package/dist/cjs/docker/types/ContainerState.js +2 -0
- package/dist/cjs/docker/types/ContainerStats.d.ts +408 -0
- package/dist/cjs/docker/types/ContainerStats.js +2 -0
- package/dist/cjs/docker/types/DockerOutputCallback.d.ts +8 -0
- package/dist/cjs/docker/types/DockerOutputCallback.js +2 -0
- package/dist/cjs/docker/types/ImageConfig.d.ts +34 -0
- package/dist/cjs/docker/types/ImageConfig.js +2 -0
- package/dist/cjs/docker/types/ImageExposePort.d.ts +17 -0
- package/dist/cjs/docker/types/ImageExposePort.js +2 -0
- package/dist/cjs/docker/types/NetworkInfo.d.ts +59 -0
- package/dist/cjs/docker/types/NetworkInfo.js +2 -0
- package/dist/cjs/docker/types/RepositoryTag.d.ts +15 -0
- package/dist/cjs/docker/types/RepositoryTag.js +2 -0
- package/dist/cjs/exports/Docker.d.ts +73 -0
- package/dist/cjs/exports/Docker.js +92 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/client/BuildContext.js +70 -0
- package/dist/esm/client/BuildKitProgress.js +190 -0
- package/dist/esm/client/DockerClient.js +307 -0
- package/dist/esm/client/DockerConnection.js +355 -0
- package/dist/esm/client/DockerIgnore.js +179 -0
- package/dist/esm/client/DockerRequestError.js +20 -0
- package/dist/esm/client/DockerStreams.js +111 -0
- package/dist/esm/client/types/ContainerCreateResponse.js +1 -0
- package/dist/esm/client/types/ContainerStopQuery.js +1 -0
- package/dist/esm/client/types/DeviceMapping.js +1 -0
- package/dist/esm/client/types/IdResponse.js +1 -0
- package/dist/esm/client/types/NetworkCreateResponse.js +1 -0
- package/dist/esm/client/types/PortBinding.js +1 -0
- package/dist/esm/docker/ConnectionOptionsBuilder.js +142 -0
- package/dist/esm/docker/Docker.js +697 -0
- package/dist/esm/docker/exceptions/DockerConnectionException.js +12 -0
- package/dist/esm/docker/exceptions/DockerContainerNotFoundException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageBuildException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageImportException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImageNotFoundException.js +13 -0
- package/dist/esm/docker/exceptions/DockerImagePullException.js +12 -0
- package/dist/esm/docker/exceptions/DockerImagePushException.js +11 -0
- package/dist/esm/docker/exceptions/DockerImageRepoTagNotFoundException.js +11 -0
- package/dist/esm/docker/exceptions/DockerNetworkNotFoundException.js +12 -0
- package/dist/esm/docker/exceptions/DockerRequestException.js +20 -0
- package/dist/esm/docker/interfaces/IDockerConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerHttpConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerHttpsConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerKeyObject.js +1 -0
- package/dist/esm/docker/interfaces/IDockerSSHConnectionOptions.js +1 -0
- package/dist/esm/docker/interfaces/IDockerSocketConnectionOptions.js +1 -0
- package/dist/esm/docker/lib/DockerContainer.js +739 -0
- package/dist/esm/docker/lib/DockerContainerTTY.js +154 -0
- package/dist/esm/docker/lib/DockerImage.js +270 -0
- package/dist/esm/docker/lib/EngineSettings.js +78 -0
- package/dist/esm/docker/lib/ParseBaseImages.js +47 -0
- package/dist/esm/docker/lib/ParseEnvToRecord.js +22 -0
- package/dist/esm/docker/lib/ParseRepositoryTag.js +45 -0
- package/dist/esm/docker/lib/RegistryAuth.js +12 -0
- package/dist/esm/docker/options/DockerPruneOptions.js +43 -0
- package/dist/esm/docker/options/auth/DockerAuthOptions.js +55 -0
- package/dist/esm/docker/options/container/ContainerCommitOptions.js +35 -0
- package/dist/esm/docker/options/container/ContainerCreateTTYOptions.js +39 -0
- package/dist/esm/docker/options/container/ContainerExecOptions.js +34 -0
- package/dist/esm/docker/options/container/ContainerExportDirectoryOptions.js +35 -0
- package/dist/esm/docker/options/container/ContainerKillOptions.js +32 -0
- package/dist/esm/docker/options/container/ContainerLogsOptions.js +52 -0
- package/dist/esm/docker/options/container/ContainerRemoveOptions.js +30 -0
- package/dist/esm/docker/options/container/ContainerSettingOptions.js +132 -0
- package/dist/esm/docker/options/container/ContainerStopOptions.js +36 -0
- package/dist/esm/docker/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
- package/dist/esm/docker/options/image/ImageBuildOptions.js +107 -0
- package/dist/esm/docker/options/image/ImageExportOptions.js +40 -0
- package/dist/esm/docker/options/image/ImageImportOptions.js +38 -0
- package/dist/esm/docker/options/image/ImagePullOptions.js +59 -0
- package/dist/esm/docker/options/image/ImagePushOptions.js +52 -0
- package/dist/esm/docker/options/image/ImageRemoveOptions.js +34 -0
- package/dist/esm/docker/options/image/ImageTagOptions.js +34 -0
- package/dist/esm/docker/options/network/NetworkCreateOptions.js +59 -0
- package/dist/esm/docker/types/ContainerBind.js +1 -0
- package/dist/esm/docker/types/ContainerCapability.js +287 -0
- package/dist/esm/docker/types/ContainerConfig.js +1 -0
- package/dist/esm/docker/types/ContainerDevice.js +1 -0
- package/dist/esm/docker/types/ContainerExecResult.js +1 -0
- package/dist/esm/docker/types/ContainerNetwork.js +1 -0
- package/dist/esm/docker/types/ContainerPort.js +1 -0
- package/dist/esm/docker/types/ContainerRestartPolicy.js +1 -0
- package/dist/esm/docker/types/ContainerState.js +1 -0
- package/dist/esm/docker/types/ContainerStats.js +1 -0
- package/dist/esm/docker/types/DockerOutputCallback.js +1 -0
- package/dist/esm/docker/types/ImageConfig.js +1 -0
- package/dist/esm/docker/types/ImageExposePort.js +1 -0
- package/dist/esm/docker/types/NetworkInfo.js +1 -0
- package/dist/esm/docker/types/RepositoryTag.js +1 -0
- package/dist/esm/exports/Docker.js +73 -0
- package/dist/types/client/BuildContext.d.ts +22 -0
- package/dist/types/client/BuildKitProgress.d.ts +81 -0
- package/dist/types/client/DockerClient.d.ts +196 -0
- package/dist/types/client/DockerConnection.d.ts +154 -0
- package/dist/types/client/DockerIgnore.d.ts +44 -0
- package/dist/types/client/DockerRequestError.d.ts +17 -0
- package/dist/types/client/DockerStreams.d.ts +35 -0
- package/dist/types/client/types/ContainerCreateResponse.d.ts +7 -0
- package/dist/types/client/types/ContainerStopQuery.d.ts +13 -0
- package/dist/types/client/types/DeviceMapping.d.ts +8 -0
- package/dist/types/client/types/IdResponse.d.ts +6 -0
- package/dist/types/client/types/NetworkCreateResponse.d.ts +7 -0
- package/dist/types/client/types/PortBinding.d.ts +10 -0
- package/dist/types/docker/ConnectionOptionsBuilder.d.ts +128 -0
- package/dist/types/docker/Docker.d.ts +301 -0
- package/dist/types/docker/exceptions/DockerConnectionException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageBuildException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageImportException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
- package/dist/types/docker/exceptions/DockerImagePullException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerImagePushException.d.ts +8 -0
- package/dist/types/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
- package/dist/types/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
- package/dist/types/docker/exceptions/DockerRequestException.d.ts +22 -0
- package/dist/types/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
- package/dist/types/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerKeyObject.d.ts +14 -0
- package/dist/types/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
- package/dist/types/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
- package/dist/types/docker/lib/DockerContainer.d.ts +315 -0
- package/dist/types/docker/lib/DockerContainerTTY.d.ts +99 -0
- package/dist/types/docker/lib/DockerImage.d.ts +153 -0
- package/dist/types/docker/lib/EngineSettings.d.ts +41 -0
- package/dist/types/docker/lib/ParseBaseImages.d.ts +9 -0
- package/dist/types/docker/lib/ParseEnvToRecord.d.ts +14 -0
- package/dist/types/docker/lib/ParseRepositoryTag.d.ts +17 -0
- package/dist/types/docker/lib/RegistryAuth.d.ts +8 -0
- package/dist/types/docker/options/DockerPruneOptions.d.ts +38 -0
- package/dist/types/docker/options/auth/DockerAuthOptions.d.ts +46 -0
- package/dist/types/docker/options/container/ContainerCommitOptions.d.ts +28 -0
- package/dist/types/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
- package/dist/types/docker/options/container/ContainerExecOptions.d.ts +26 -0
- package/dist/types/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
- package/dist/types/docker/options/container/ContainerKillOptions.d.ts +25 -0
- package/dist/types/docker/options/container/ContainerLogsOptions.d.ts +48 -0
- package/dist/types/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/types/docker/options/container/ContainerSettingOptions.d.ts +137 -0
- package/dist/types/docker/options/container/ContainerStopOptions.d.ts +28 -0
- package/dist/types/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/types/docker/options/image/ImageBuildOptions.d.ts +117 -0
- package/dist/types/docker/options/image/ImageExportOptions.d.ts +33 -0
- package/dist/types/docker/options/image/ImageImportOptions.d.ts +28 -0
- package/dist/types/docker/options/image/ImagePullOptions.d.ts +49 -0
- package/dist/types/docker/options/image/ImagePushOptions.d.ts +41 -0
- package/dist/types/docker/options/image/ImageRemoveOptions.d.ts +26 -0
- package/dist/types/docker/options/image/ImageTagOptions.d.ts +25 -0
- package/dist/types/docker/options/network/NetworkCreateOptions.d.ts +54 -0
- package/dist/types/docker/types/ContainerBind.d.ts +19 -0
- package/dist/types/docker/types/ContainerCapability.d.ts +286 -0
- package/dist/types/docker/types/ContainerConfig.d.ts +67 -0
- package/dist/types/docker/types/ContainerDevice.d.ts +19 -0
- package/dist/types/docker/types/ContainerExecResult.d.ts +20 -0
- package/dist/types/docker/types/ContainerNetwork.d.ts +46 -0
- package/dist/types/docker/types/ContainerPort.d.ts +25 -0
- package/dist/types/docker/types/ContainerRestartPolicy.d.ts +11 -0
- package/dist/types/docker/types/ContainerState.d.ts +48 -0
- package/dist/types/docker/types/ContainerStats.d.ts +408 -0
- package/dist/types/docker/types/DockerOutputCallback.d.ts +8 -0
- package/dist/types/docker/types/ImageConfig.d.ts +34 -0
- package/dist/types/docker/types/ImageExposePort.d.ts +17 -0
- package/dist/types/docker/types/NetworkInfo.d.ts +59 -0
- package/dist/types/docker/types/RepositoryTag.d.ts +15 -0
- package/dist/types/exports/Docker.d.ts +73 -0
- package/package.json +57 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The images of the FROM instructions of a Dockerfile, pulled before a build with credentials: their flags (--platform)
|
|
3
|
+
* and their stage names (AS build) are skipped, the stages of the Dockerfile and scratch are not images, the variables
|
|
4
|
+
* are the ARG declared before the first FROM (with their defaults) and the build arguments. The images whose variables
|
|
5
|
+
* are unknown are skipped
|
|
6
|
+
* @param dockerfile the content of the Dockerfile
|
|
7
|
+
* @param buildargs
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseBaseImages(dockerfile: string, buildargs?: Record<string, string>): string[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn a list of environment variables as the Engine API gives them (`['PATH=/usr/bin', 'MODE=a=b']`) into a record by
|
|
3
|
+
* name. A variable is split at its first `=`; an entry without `=` is skipped; a repeated name keeps its last value.
|
|
4
|
+
* @param rawEnv The `NAME=value` entries; `null` or `undefined` for none.
|
|
5
|
+
* @returns The values by name (`{PATH: '/usr/bin', MODE: 'a=b'}`).
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {parseEnvToRecord} from 'lakutata/com/docker'
|
|
9
|
+
*
|
|
10
|
+
* const env: Record<string, string> = parseEnvToRecord(['PATH=/usr/bin', 'MODE=a=b', 'EMPTY='])
|
|
11
|
+
* console.log(env) //{PATH: '/usr/bin', MODE: 'a=b', EMPTY: ''}
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseEnvToRecord(rawEnv?: string[] | null): Record<string, string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RepositoryTag } from '../types/RepositoryTag.js';
|
|
2
|
+
/**
|
|
3
|
+
* Split an image reference into its repository and its tag (or digest). A digest (`@`) wins over a tag; the port of a
|
|
4
|
+
* registry (`registry:5000/app`) is not taken for a tag.
|
|
5
|
+
* @param input The image reference: `alpine`, `alpine:3.20`, `registry.example.com:5000/team/app:1.0`,
|
|
6
|
+
* `alpine@sha256:…`.
|
|
7
|
+
* @returns The repository, and the tag (or the digest, without its `@`) when the reference has one.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import {parseRepositoryTag, type RepositoryTag} from 'lakutata/com/docker'
|
|
11
|
+
*
|
|
12
|
+
* const reference: RepositoryTag = parseRepositoryTag('registry.example.com:5000/team/app:1.0')
|
|
13
|
+
* console.log(reference) //{repo: 'registry.example.com:5000/team/app', tag: '1.0'}
|
|
14
|
+
* console.log(parseRepositoryTag('registry.example.com:5000/team/app')) //{repo: 'registry.example.com:5000/team/app'}
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseRepositoryTag(input: string): RepositoryTag;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DockerRegistryAuth } from '../../client/DockerClient.js';
|
|
2
|
+
import { type DockerAuthOptions } from '../options/auth/DockerAuthOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* The registry credentials sent to the daemon (the login, the pulls, the pushes and the builds), the tokens included
|
|
5
|
+
* @param auth
|
|
6
|
+
*/
|
|
7
|
+
export declare function registryAuth(auth: DockerAuthOptions): DockerRegistryAuth;
|
|
8
|
+
export declare function registryAuth(auth?: DockerAuthOptions): DockerRegistryAuth | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* Which unused resources {@link Docker.prune} removes, each kind as its `docker … prune` command does without options.
|
|
4
|
+
* Called without options, it prunes the containers and the images; the networks and the volumes only when asked (the
|
|
5
|
+
* volumes, as `docker system prune --volumes`).
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
9
|
+
*
|
|
10
|
+
* declare const docker: Docker
|
|
11
|
+
*
|
|
12
|
+
* //The stopped containers and the unused networks, keeping the images and the volumes
|
|
13
|
+
* await docker.prune({containers: true, images: false, networks: true, volumes: false})
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class DockerPruneOptions extends DTO {
|
|
17
|
+
/**
|
|
18
|
+
* Remove the stopped containers (`docker container prune`).
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
containers?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Remove the dangling images, untagged and not used by a container (`docker image prune`, without `--all`).
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
images?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Remove the networks no container uses (`docker network prune`).
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
networks?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Remove the volumes no container uses (`docker volume prune`): the anonymous ones only on Docker Engine 23 and
|
|
34
|
+
* later (API 1.42), the named ones too before.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
volumes?: boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The credentials of an image registry: checked by {@link Docker.loginRepository} and
|
|
4
|
+
* {@link Docker.checkRepositoryAuth}, and sent with the image pulls ({@link ImagePullOptions.auth}), pushes
|
|
5
|
+
* ({@link ImagePushOptions.auth}) and builds ({@link ImageBuildOptions.auth}), each of them given every field set
|
|
6
|
+
* (the tokens included). Only `serverAddress` is required.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
10
|
+
*
|
|
11
|
+
* declare const docker: Docker
|
|
12
|
+
*
|
|
13
|
+
* const valid: boolean = await docker.checkRepositoryAuth({
|
|
14
|
+
* serverAddress: 'registry.example.com:5000',
|
|
15
|
+
* username: 'ci',
|
|
16
|
+
* password: process.env.REGISTRY_PASSWORD ?? ''
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class DockerAuthOptions extends DTO {
|
|
21
|
+
/**
|
|
22
|
+
* The user name.
|
|
23
|
+
*/
|
|
24
|
+
username?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The password, or a personal access token of the registry.
|
|
27
|
+
*/
|
|
28
|
+
password?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The registry address, a host name or an IP address with its port when it is not the default one, without a
|
|
31
|
+
* protocol (`registry.example.com`, `10.0.0.5:5000`). Required.
|
|
32
|
+
*/
|
|
33
|
+
serverAddress: string;
|
|
34
|
+
/**
|
|
35
|
+
* The e-mail address of the account, for the old registries asking for it; the current ones ignore it.
|
|
36
|
+
*/
|
|
37
|
+
email?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* An identity token (an OAuth refresh token) the registry gave at a previous login, used instead of the password.
|
|
40
|
+
*/
|
|
41
|
+
identityToken?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* A bearer token the registry gave, used instead of the user name and the password.
|
|
44
|
+
*/
|
|
45
|
+
registryToken?: string | undefined;
|
|
46
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* How `DockerContainer.commit()` creates an image of the container's current file system (`docker commit`), the
|
|
4
|
+
* created image returned.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* const image = await container.commit({repoTag: 'web-snapshot:2026-10-04'})
|
|
13
|
+
* console.log(image.id)
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class ContainerCommitOptions extends DTO {
|
|
17
|
+
/**
|
|
18
|
+
* The repository and tag of the image, `repo:tag` (`my-app:snapshot`, `registry.example.com:5000/team/app:1.0`); a
|
|
19
|
+
* repository without a tag is tagged `latest`. Without it, the image has no name (dangling) and is known by its ID
|
|
20
|
+
* only.
|
|
21
|
+
*/
|
|
22
|
+
repoTag?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Pause the container while the image is created, for a consistent file system; it resumes after.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
pauseBeforeCommitting?: boolean;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import { ContainerTTYConsoleSizeOptions } from './ContainerTTYConsoleSizeOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* The interactive command `DockerContainer.createTTY()` runs in a running container with a terminal (`docker exec -it`),
|
|
5
|
+
* read and written through the returned `DockerContainerTTY`.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
9
|
+
*
|
|
10
|
+
* declare const docker: Docker
|
|
11
|
+
*
|
|
12
|
+
* const container = await docker.getContainer('web')
|
|
13
|
+
* const tty = await container.createTTY({cmd: ['/bin/bash', '-l'], consoleSize: {cols: 120, rows: 40}})
|
|
14
|
+
* tty.onData((chunk: Buffer): void => {
|
|
15
|
+
* process.stdout.write(chunk)
|
|
16
|
+
* })
|
|
17
|
+
* tty.write('ls -la\n')
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class ContainerCreateTTYOptions extends DTO {
|
|
21
|
+
/**
|
|
22
|
+
* The command: the executable followed by its arguments (`['/bin/bash', '-l']`, at least one item), run as they
|
|
23
|
+
* are; or a command line (`'top -d 1'`), run by `/bin/sh -c`. The default needs a shell in the image (not in the
|
|
24
|
+
* distroless ones).
|
|
25
|
+
* @default ['/bin/sh']
|
|
26
|
+
*/
|
|
27
|
+
cmd?: string | string[];
|
|
28
|
+
/**
|
|
29
|
+
* The terminal's initial size; without it, Docker's default size, until `DockerContainerTTY.resize()` is called.
|
|
30
|
+
*/
|
|
31
|
+
consoleSize?: ContainerTTYConsoleSizeOptions;
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The command `DockerContainer.exec()` runs in a running container, without a terminal nor an input (`docker exec`); it
|
|
4
|
+
* resolves once the command exits, with its exit code and its standard output and error output apart.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker, type ContainerExecResult} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* const listing: ContainerExecResult = await container.exec({cmd: ['ls', '-la', '/app']})
|
|
13
|
+
* //A command line, run by /bin/sh -c
|
|
14
|
+
* const count: ContainerExecResult = await container.exec({cmd: 'ls /app | wc -l'})
|
|
15
|
+
* if (count.exitCode !== 0) console.error(count.stderr)
|
|
16
|
+
* console.log(listing.stdout, count.stdout)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class ContainerExecOptions extends DTO {
|
|
20
|
+
/**
|
|
21
|
+
* The command: the executable followed by its arguments (`['ls', '-la', '/app']`, at least one item), run as they
|
|
22
|
+
* are; or a command line (`'ls /app | wc -l'`), run by `/bin/sh -c`, which needs a shell in the container.
|
|
23
|
+
* Required.
|
|
24
|
+
*/
|
|
25
|
+
cmd: string | string[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import { Writable } from 'node:stream';
|
|
3
|
+
/**
|
|
4
|
+
* What `DockerContainer.exportDirectory()` copies out of a container (`docker cp`): a file or directory of the
|
|
5
|
+
* container, written as an uncompressed tar archive to a file or a stream. The container may be stopped.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
9
|
+
*
|
|
10
|
+
* declare const docker: Docker
|
|
11
|
+
*
|
|
12
|
+
* const container = await docker.getContainer('web')
|
|
13
|
+
* await container.exportDirectory({path: '/var/log/nginx', destination: '/backup/nginx-logs.tar'})
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class ContainerExportDirectoryOptions extends DTO {
|
|
17
|
+
/**
|
|
18
|
+
* The absolute path of the file or directory in the container (`/var/log/nginx`); the archive holds it under its
|
|
19
|
+
* base name (`nginx/…`). Required.
|
|
20
|
+
*/
|
|
21
|
+
path: string;
|
|
22
|
+
/**
|
|
23
|
+
* Where the tar archive is written: the path of a host file, created or replaced, or a writable stream, ended once
|
|
24
|
+
* the archive is written. Required.
|
|
25
|
+
*/
|
|
26
|
+
destination: string | Writable;
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* How `DockerContainer.kill()` kills a running container (`docker kill`).
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
7
|
+
*
|
|
8
|
+
* declare const docker: Docker
|
|
9
|
+
*
|
|
10
|
+
* const container = await docker.getContainer('web')
|
|
11
|
+
* //Reload the configuration of the main process
|
|
12
|
+
* await container.kill({signal: 'SIGHUP'})
|
|
13
|
+
* //SIGKILL
|
|
14
|
+
* await container.kill()
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContainerKillOptions extends DTO {
|
|
18
|
+
/**
|
|
19
|
+
* The signal sent to the container's main process: a name (`'SIGHUP'`, `'SIGTERM'`, also without its `SIG` prefix)
|
|
20
|
+
* or a number (`15`, `'15'`). A signal the daemon does not know is refused by it (`DockerRequestException`,
|
|
21
|
+
* HTTP 400 or 500).
|
|
22
|
+
* @default 'SIGKILL'
|
|
23
|
+
*/
|
|
24
|
+
signal?: string | number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* Which logs `DockerContainer.logs()` reads (`docker logs`): a readable stream of the container's standard output and
|
|
4
|
+
* error output, interleaved, as text (the multiplexing of a container without a terminal removed).
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* //The last 100 lines of the past hour, then the new ones as they are written
|
|
13
|
+
* const logs: NodeJS.ReadableStream = await container.logs({
|
|
14
|
+
* since: Math.floor(Date.now() / 1000) - 3600,
|
|
15
|
+
* tail: 100,
|
|
16
|
+
* timestamps: true
|
|
17
|
+
* })
|
|
18
|
+
* logs.pipe(process.stdout)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class ContainerLogsOptions extends DTO {
|
|
22
|
+
/**
|
|
23
|
+
* Keep the stream open and give the new lines as the container writes them (`docker logs --follow`): the stream
|
|
24
|
+
* ends when the container stops. `false` ends the stream after the existing lines.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
follow?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Only the lines written from this time on, a UNIX timestamp in seconds; `0` for no lower bound.
|
|
30
|
+
* @default 0
|
|
31
|
+
*/
|
|
32
|
+
since?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Only the lines written before this time, a UNIX timestamp in seconds; `0` for no upper bound.
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
until?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Prefix each line with the time it was written, an RFC 3339 date with nanoseconds
|
|
40
|
+
* (`2026-10-04T08:15:30.123456789Z `).
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
timestamps?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Only this number of lines, from the end of the existing logs; all the lines when absent.
|
|
46
|
+
*/
|
|
47
|
+
tail?: number;
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* How `DockerContainer.remove()` removes a container (`docker rm -v`): its anonymous volumes are removed with it, the
|
|
4
|
+
* named volumes are kept.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* await container.remove({force: true})
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class ContainerRemoveOptions extends DTO {
|
|
16
|
+
/**
|
|
17
|
+
* Kill the container first when it is running (`docker rm --force`); without it, removing a running container
|
|
18
|
+
* fails.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
force?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import { ContainerDevice } from '../../types/ContainerDevice.js';
|
|
3
|
+
import { type ContainerRestartPolicy } from '../../types/ContainerRestartPolicy.js';
|
|
4
|
+
import { ContainerPort } from '../../types/ContainerPort.js';
|
|
5
|
+
import { ContainerBind } from '../../types/ContainerBind.js';
|
|
6
|
+
import { ContainerNetwork } from '../../types/ContainerNetwork.js';
|
|
7
|
+
import { ContainerCapability } from '../../types/ContainerCapability.js';
|
|
8
|
+
/**
|
|
9
|
+
* The settings of a container: given to {@link Docker.createContainer} and `DockerImage.run()` (create, then start),
|
|
10
|
+
* which use the image's defaults (command, environment…) for the settings absent, and to `DockerContainer.update()`,
|
|
11
|
+
* which changes the settings given and keeps the others: the limits and the restart policy live, the others by
|
|
12
|
+
* recreating the container. Every option is optional.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import {Docker, ContainerCapability} from 'lakutata/com/docker'
|
|
16
|
+
*
|
|
17
|
+
* declare const docker: Docker
|
|
18
|
+
*
|
|
19
|
+
* const image = await docker.pullImage({repo: 'nginx', tag: '1.27'})
|
|
20
|
+
* const container = await image.run({
|
|
21
|
+
* name: 'web',
|
|
22
|
+
* env: {TZ: 'UTC'},
|
|
23
|
+
* memoryLimit: 256 * 1024 * 1024,
|
|
24
|
+
* restartPolicy: 'unless-stopped',
|
|
25
|
+
* ports: [{port: 80, type: 'tcp', hostPorts: [8080]}],
|
|
26
|
+
* binds: [{hostPath: '/srv/web/html', containerPath: '/usr/share/nginx/html', rw: false}],
|
|
27
|
+
* networks: [{networkName: 'front'}],
|
|
28
|
+
* capabilities: [ContainerCapability.NET_ADMIN]
|
|
29
|
+
* })
|
|
30
|
+
* //The same container, with 512 MiB of memory, restarted 3 times at most when it fails
|
|
31
|
+
* await container.update({memoryLimit: 512 * 1024 * 1024, restartPolicy: 'on-failure:3'})
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class ContainerSettingOptions extends DTO {
|
|
35
|
+
/**
|
|
36
|
+
* The container name, unique on the Docker host: letters, digits, `_`, `.` and `-`, starting with a letter or a
|
|
37
|
+
* digit. Docker generates one (`happy_turing`) when absent.
|
|
38
|
+
*/
|
|
39
|
+
name?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The host name seen in the container; Docker uses the first 12 characters of the container ID when absent.
|
|
42
|
+
*/
|
|
43
|
+
hostname?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Run the container privileged (`docker run --privileged`): every capability and every host device, without the
|
|
46
|
+
* security restrictions. It gives the container full access to the host.
|
|
47
|
+
*/
|
|
48
|
+
privileged?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Give the container's main process a terminal (`docker run -t`): its output is then not multiplexed, and
|
|
51
|
+
* `DockerContainer.logs()` gives it as written.
|
|
52
|
+
*/
|
|
53
|
+
tty?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The environment variables, by name (`{NODE_ENV: 'production'}`), added to the image's ones; the values are
|
|
56
|
+
* strings.
|
|
57
|
+
*/
|
|
58
|
+
env?: Record<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* The memory limit, in bytes (`256 * 1024 * 1024` for 256 MiB); Docker requires at least 6 MiB. `0` or absent for
|
|
61
|
+
* no limit. The swap limit is Docker's default: as much swap as memory.
|
|
62
|
+
* @default 0
|
|
63
|
+
*/
|
|
64
|
+
memoryLimit?: number;
|
|
65
|
+
/**
|
|
66
|
+
* The indexes of the host CPUs the container may run on (`[0, 1]`, sent to Docker as `"0,1"`); all of them when
|
|
67
|
+
* absent. Each one is an integer.
|
|
68
|
+
*/
|
|
69
|
+
cpuSet?: number[];
|
|
70
|
+
/**
|
|
71
|
+
* When Docker restarts the container after it exits: `''`, `'no'`, `'always'`, `'unless-stopped'`,
|
|
72
|
+
* `'on-failure'` (with no limit on the retries) or `'on-failure:N'` (`N` retries at most, `'on-failure:3'`); another
|
|
73
|
+
* value fails the validation. `''` or absent for no restart.
|
|
74
|
+
*/
|
|
75
|
+
restartPolicy?: ContainerRestartPolicy;
|
|
76
|
+
/**
|
|
77
|
+
* The container ports published on the host (`docker run -p`), each one required to have a `port` (a valid port
|
|
78
|
+
* number) and a `type` (`'tcp'` or `'udp'`), sent to Docker as `"80/tcp"`. Its `hostPorts` are the host ports
|
|
79
|
+
* forwarded to it, bound on every host address (`[8080]`, each one once); empty, or absent, it is published on no
|
|
80
|
+
* host port.
|
|
81
|
+
*/
|
|
82
|
+
ports?: (Pick<ContainerPort, 'port' | 'type'> & Partial<Pick<ContainerPort, 'hostPorts'>>)[];
|
|
83
|
+
/**
|
|
84
|
+
* The host files and directories mounted into the container (`docker run -v`), each one required to have its
|
|
85
|
+
* `hostPath`, its `containerPath` and `rw` (`false` for read-only); sent to Docker as
|
|
86
|
+
* `"hostPath:containerPath:rw"` or `"hostPath:containerPath:ro"`.
|
|
87
|
+
*/
|
|
88
|
+
binds?: ContainerBind[];
|
|
89
|
+
/**
|
|
90
|
+
* The host devices made available in the container (`docker run --device`), each one required to have its
|
|
91
|
+
* `hostPath` and its `containerPath`; its `cgroupPermissions`, a combination of `r`, `w` and `m`, is `'rwm'` by
|
|
92
|
+
* default.
|
|
93
|
+
*/
|
|
94
|
+
devices?: (Pick<ContainerDevice, 'hostPath' | 'containerPath'> & Partial<Pick<ContainerDevice, 'cgroupPermissions'>>)[];
|
|
95
|
+
/**
|
|
96
|
+
* The networks the container is connected to, each one required to have its `networkName`; the default `bridge`
|
|
97
|
+
* network when absent. On a user-defined network, `ip` (an IPv4 address) and `ipv6` (an IPv6 address) set the
|
|
98
|
+
* container's static addresses, within the network's range; empty or absent, Docker allocates them. They are
|
|
99
|
+
* ignored on `bridge`, `host` and `none`.
|
|
100
|
+
*/
|
|
101
|
+
networks?: (Pick<ContainerNetwork, 'networkName'> & Partial<Pick<ContainerNetwork, 'ip' | 'ipv6'>>)[];
|
|
102
|
+
/**
|
|
103
|
+
* Keep the kernel's OOM killer from killing the container's processes when it runs out of memory; set it with a
|
|
104
|
+
* memory limit only, or the host may kill its own processes instead.
|
|
105
|
+
*/
|
|
106
|
+
OOMKillDisable?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The Linux capabilities added to Docker's default set (`docker run --cap-add`); a value outside
|
|
109
|
+
* {@link ContainerCapability} fails the validation. None added when absent (`update()` keeps the container's).
|
|
110
|
+
*/
|
|
111
|
+
capabilities?: ContainerCapability[];
|
|
112
|
+
/**
|
|
113
|
+
* The cgroup the container runs in (the Docker Engine's `HostConfig.Cgroup`): `'container:<name|id>'` shares
|
|
114
|
+
* another container's cgroup; its own when absent.
|
|
115
|
+
*/
|
|
116
|
+
cgroup?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The parent cgroup the container's cgroup is created under (`docker run --cgroup-parent`); a relative path is
|
|
119
|
+
* relative to the cgroup of the init process. The cgroups are created when missing.
|
|
120
|
+
*/
|
|
121
|
+
cgroupParent?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The PID namespace of the container (`docker run --pid`): `'container:<name|id>'` joins another container's,
|
|
124
|
+
* `'host'` uses the host's; its own when absent.
|
|
125
|
+
*/
|
|
126
|
+
pidMode?: string;
|
|
127
|
+
/**
|
|
128
|
+
* The command, replacing the image's `CMD`: the executable followed by its arguments (`['node', 'server.js']`), an
|
|
129
|
+
* array only.
|
|
130
|
+
*/
|
|
131
|
+
cmd?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* The entry point, replacing the image's `ENTRYPOINT`: the executable followed by its arguments, an array only.
|
|
134
|
+
* `['']` removes the image's entry point: the command runs alone.
|
|
135
|
+
*/
|
|
136
|
+
entrypoint?: string[];
|
|
137
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* How `DockerContainer.stop()` and `DockerContainer.restart()` stop a running container (`docker stop`): Docker sends
|
|
4
|
+
* the stop signal to its main process, then kills it with `SIGKILL` when it has not exited after the timeout.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* //Up to 30 seconds to finish the requests in progress
|
|
13
|
+
* await container.stop({signal: 'SIGINT', timeout: 30})
|
|
14
|
+
* await container.restart({timeout: 5})
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContainerStopOptions extends DTO {
|
|
18
|
+
/**
|
|
19
|
+
* The signal sent first, a name (`'SIGINT'`) or a number (`'2'`); the container's stop signal when absent (its
|
|
20
|
+
* image's `STOPSIGNAL`, `SIGTERM` by default).
|
|
21
|
+
*/
|
|
22
|
+
signal?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The time given to the container to exit before it is killed, in seconds (a whole number); the container's stop
|
|
25
|
+
* timeout when absent, 10 seconds by default.
|
|
26
|
+
*/
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
/**
|
|
3
|
+
* The size of a container terminal, in characters: its initial size ({@link ContainerCreateTTYOptions.consoleSize}),
|
|
4
|
+
* and its new size given to `DockerContainerTTY.resize()` when the user's terminal is resized. Both are required.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
8
|
+
*
|
|
9
|
+
* declare const docker: Docker
|
|
10
|
+
*
|
|
11
|
+
* const container = await docker.getContainer('web')
|
|
12
|
+
* const tty = await container.createTTY({cmd: 'sh', consoleSize: {cols: 120, rows: 40}})
|
|
13
|
+
* //The user's terminal was resized
|
|
14
|
+
* await tty.resize({cols: 160, rows: 50})
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class ContainerTTYConsoleSizeOptions extends DTO {
|
|
18
|
+
/**
|
|
19
|
+
* The width, in columns (characters). Required.
|
|
20
|
+
*/
|
|
21
|
+
cols: number;
|
|
22
|
+
/**
|
|
23
|
+
* The height, in rows (lines). Required.
|
|
24
|
+
*/
|
|
25
|
+
rows: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { DTO } from '@lakutata/core';
|
|
2
|
+
import type { DockerOutputCallback } from '../../types/DockerOutputCallback.js';
|
|
3
|
+
import { DockerAuthOptions } from '../auth/DockerAuthOptions.js';
|
|
4
|
+
/**
|
|
5
|
+
* How {@link Docker.buildImage} builds an image with BuildKit (`docker build`), the built image returned. The build
|
|
6
|
+
* context is the listed files and directories of the working directory, without the ones its `.dockerignore` excludes;
|
|
7
|
+
* the Dockerfile is always sent. `workdir` and `files` are required.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import {Docker} from 'lakutata/com/docker'
|
|
11
|
+
*
|
|
12
|
+
* declare const docker: Docker
|
|
13
|
+
*
|
|
14
|
+
* const image = await docker.buildImage({
|
|
15
|
+
* workdir: '/srv/projects/api',
|
|
16
|
+
* files: ['package.json', 'package-lock.json', 'dist'],
|
|
17
|
+
* repoTag: 'api:1.4.0',
|
|
18
|
+
* platform: 'linux/amd64',
|
|
19
|
+
* buildargs: {NODE_VERSION: '22'},
|
|
20
|
+
* outputCallback: (output: Record<string, any>): void => {
|
|
21
|
+
* if (output.stream) console.log(output.stream)
|
|
22
|
+
* }
|
|
23
|
+
* })
|
|
24
|
+
* console.log(image.id)
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class ImageBuildOptions extends DTO {
|
|
28
|
+
/**
|
|
29
|
+
* The directory of the build context on this machine, holding the Dockerfile and its `.dockerignore`. Required.
|
|
30
|
+
*/
|
|
31
|
+
workdir: string;
|
|
32
|
+
/**
|
|
33
|
+
* The files and directories of `workdir` sent as the build context, their paths relative to it (`['package.json',
|
|
34
|
+
* 'dist']`); the directories are sent with their content, the files excluded by `.dockerignore` are skipped, and
|
|
35
|
+
* the Dockerfile is added. Required.
|
|
36
|
+
*/
|
|
37
|
+
files: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The path of the Dockerfile in the build context, relative to `workdir`. Ignored when `remote` points to a
|
|
40
|
+
* Dockerfile.
|
|
41
|
+
* @default 'Dockerfile'
|
|
42
|
+
*/
|
|
43
|
+
dockerfile?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The repository and tag of the image, `name:tag` (`api:1.4.0`); a name without a tag is tagged `latest`. When
|
|
46
|
+
* absent, the image is named `unnamed_img_<random hexadecimal>:latest`.
|
|
47
|
+
*/
|
|
48
|
+
repoTag?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The platform of the image, `os[/arch[/variant]]` (`linux/amd64`, `linux/arm64/v8`); `''` for the Docker host's
|
|
51
|
+
* platform.
|
|
52
|
+
* @default ''
|
|
53
|
+
*/
|
|
54
|
+
platform?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The stage of a multi-stage Dockerfile to build (`FROM … AS <stage>`); `''` for the last stage.
|
|
57
|
+
* @default ''
|
|
58
|
+
*/
|
|
59
|
+
target?: string;
|
|
60
|
+
/**
|
|
61
|
+
* A remote build context: a Git repository URL or an HTTP/HTTPS URL. A URL of a text file is used as the
|
|
62
|
+
* Dockerfile; a URL of a tarball is downloaded by Docker and used as the context, which must then hold the
|
|
63
|
+
* `dockerfile` path.
|
|
64
|
+
*/
|
|
65
|
+
remote?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Suppress the verbose build output (`docker build --quiet`).
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
quiet?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The former, misspelt name of {@link ImageBuildOptions.quiet}: the build is quiet when either is `true`.
|
|
73
|
+
* @deprecated Use `quiet`.
|
|
74
|
+
*/
|
|
75
|
+
quite?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Build without the build cache (`docker build --no-cache`).
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
nocache?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Remove the intermediate containers after a successful build (the legacy builder's `--rm`; BuildKit creates
|
|
83
|
+
* none).
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
rm?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Always remove the intermediate containers, even after a failure (the legacy builder's `--force-rm`; BuildKit
|
|
89
|
+
* creates none).
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
forcerm?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The size of `/dev/shm` in the build containers, in bytes, greater than 0; 64 MiB when absent.
|
|
95
|
+
*/
|
|
96
|
+
shmsize?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The build arguments, by name (`{NODE_VERSION: '22'}`): the values of the Dockerfile's `ARG` instructions, in the
|
|
99
|
+
* environment of its `RUN` instructions and expanded in its other instructions. They stay visible in the image's
|
|
100
|
+
* history: not for the secrets.
|
|
101
|
+
*/
|
|
102
|
+
buildargs?: {
|
|
103
|
+
[key: string]: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* The credentials of a private registry the base images come from. When given, the images of the Dockerfile's
|
|
107
|
+
* `FROM` instructions are pulled first with them (on `platform`, their progress given to `outputCallback`), and
|
|
108
|
+
* BuildKit is given them (the tokens included) for `auth.serverAddress`.
|
|
109
|
+
*/
|
|
110
|
+
auth?: DockerAuthOptions;
|
|
111
|
+
/**
|
|
112
|
+
* Receive the build progress as it arrives: the BuildKit progress as the lines of `docker build --progress=plain`
|
|
113
|
+
* (`{id: 'moby.buildkit.trace', stream: '#2 [1/2] FROM alpine'}`), and the other messages of Docker as they are
|
|
114
|
+
* sent (the built image's ID, `{aux: {ID: 'sha256:…'}}`, the errors, `{error: '…'}`).
|
|
115
|
+
*/
|
|
116
|
+
outputCallback?: DockerOutputCallback;
|
|
117
|
+
}
|