@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.
Files changed (305) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +309 -0
  3. package/THIRD_PARTY_NOTICES.md +299 -0
  4. package/dist/cjs/client/BuildContext.d.ts +22 -0
  5. package/dist/cjs/client/BuildContext.js +76 -0
  6. package/dist/cjs/client/BuildKitProgress.d.ts +81 -0
  7. package/dist/cjs/client/BuildKitProgress.js +195 -0
  8. package/dist/cjs/client/DockerClient.d.ts +196 -0
  9. package/dist/cjs/client/DockerClient.js +312 -0
  10. package/dist/cjs/client/DockerConnection.d.ts +154 -0
  11. package/dist/cjs/client/DockerConnection.js +397 -0
  12. package/dist/cjs/client/DockerIgnore.d.ts +44 -0
  13. package/dist/cjs/client/DockerIgnore.js +186 -0
  14. package/dist/cjs/client/DockerRequestError.d.ts +17 -0
  15. package/dist/cjs/client/DockerRequestError.js +24 -0
  16. package/dist/cjs/client/DockerStreams.d.ts +35 -0
  17. package/dist/cjs/client/DockerStreams.js +117 -0
  18. package/dist/cjs/client/types/ContainerCreateResponse.d.ts +7 -0
  19. package/dist/cjs/client/types/ContainerCreateResponse.js +2 -0
  20. package/dist/cjs/client/types/ContainerStopQuery.d.ts +13 -0
  21. package/dist/cjs/client/types/ContainerStopQuery.js +2 -0
  22. package/dist/cjs/client/types/DeviceMapping.d.ts +8 -0
  23. package/dist/cjs/client/types/DeviceMapping.js +2 -0
  24. package/dist/cjs/client/types/IdResponse.d.ts +6 -0
  25. package/dist/cjs/client/types/IdResponse.js +2 -0
  26. package/dist/cjs/client/types/NetworkCreateResponse.d.ts +7 -0
  27. package/dist/cjs/client/types/NetworkCreateResponse.js +2 -0
  28. package/dist/cjs/client/types/PortBinding.d.ts +10 -0
  29. package/dist/cjs/client/types/PortBinding.js +2 -0
  30. package/dist/cjs/docker/ConnectionOptionsBuilder.d.ts +128 -0
  31. package/dist/cjs/docker/ConnectionOptionsBuilder.js +150 -0
  32. package/dist/cjs/docker/Docker.d.ts +301 -0
  33. package/dist/cjs/docker/Docker.js +703 -0
  34. package/dist/cjs/docker/exceptions/DockerConnectionException.d.ts +9 -0
  35. package/dist/cjs/docker/exceptions/DockerConnectionException.js +16 -0
  36. package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
  37. package/dist/cjs/docker/exceptions/DockerContainerNotFoundException.js +16 -0
  38. package/dist/cjs/docker/exceptions/DockerImageBuildException.d.ts +9 -0
  39. package/dist/cjs/docker/exceptions/DockerImageBuildException.js +16 -0
  40. package/dist/cjs/docker/exceptions/DockerImageImportException.d.ts +9 -0
  41. package/dist/cjs/docker/exceptions/DockerImageImportException.js +16 -0
  42. package/dist/cjs/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
  43. package/dist/cjs/docker/exceptions/DockerImageNotFoundException.js +17 -0
  44. package/dist/cjs/docker/exceptions/DockerImagePullException.d.ts +9 -0
  45. package/dist/cjs/docker/exceptions/DockerImagePullException.js +16 -0
  46. package/dist/cjs/docker/exceptions/DockerImagePushException.d.ts +8 -0
  47. package/dist/cjs/docker/exceptions/DockerImagePushException.js +15 -0
  48. package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
  49. package/dist/cjs/docker/exceptions/DockerImageRepoTagNotFoundException.js +15 -0
  50. package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
  51. package/dist/cjs/docker/exceptions/DockerNetworkNotFoundException.js +16 -0
  52. package/dist/cjs/docker/exceptions/DockerRequestException.d.ts +22 -0
  53. package/dist/cjs/docker/exceptions/DockerRequestException.js +24 -0
  54. package/dist/cjs/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
  55. package/dist/cjs/docker/interfaces/IDockerConnectionOptions.js +2 -0
  56. package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
  57. package/dist/cjs/docker/interfaces/IDockerHttpConnectionOptions.js +2 -0
  58. package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
  59. package/dist/cjs/docker/interfaces/IDockerHttpsConnectionOptions.js +2 -0
  60. package/dist/cjs/docker/interfaces/IDockerKeyObject.d.ts +14 -0
  61. package/dist/cjs/docker/interfaces/IDockerKeyObject.js +2 -0
  62. package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
  63. package/dist/cjs/docker/interfaces/IDockerSSHConnectionOptions.js +2 -0
  64. package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
  65. package/dist/cjs/docker/interfaces/IDockerSocketConnectionOptions.js +2 -0
  66. package/dist/cjs/docker/lib/DockerContainer.d.ts +315 -0
  67. package/dist/cjs/docker/lib/DockerContainer.js +742 -0
  68. package/dist/cjs/docker/lib/DockerContainerTTY.d.ts +99 -0
  69. package/dist/cjs/docker/lib/DockerContainerTTY.js +157 -0
  70. package/dist/cjs/docker/lib/DockerImage.d.ts +153 -0
  71. package/dist/cjs/docker/lib/DockerImage.js +273 -0
  72. package/dist/cjs/docker/lib/EngineSettings.d.ts +41 -0
  73. package/dist/cjs/docker/lib/EngineSettings.js +86 -0
  74. package/dist/cjs/docker/lib/ParseBaseImages.d.ts +9 -0
  75. package/dist/cjs/docker/lib/ParseBaseImages.js +50 -0
  76. package/dist/cjs/docker/lib/ParseEnvToRecord.d.ts +14 -0
  77. package/dist/cjs/docker/lib/ParseEnvToRecord.js +25 -0
  78. package/dist/cjs/docker/lib/ParseRepositoryTag.d.ts +17 -0
  79. package/dist/cjs/docker/lib/ParseRepositoryTag.js +48 -0
  80. package/dist/cjs/docker/lib/RegistryAuth.d.ts +8 -0
  81. package/dist/cjs/docker/lib/RegistryAuth.js +15 -0
  82. package/dist/cjs/docker/options/DockerPruneOptions.d.ts +38 -0
  83. package/dist/cjs/docker/options/DockerPruneOptions.js +47 -0
  84. package/dist/cjs/docker/options/auth/DockerAuthOptions.d.ts +46 -0
  85. package/dist/cjs/docker/options/auth/DockerAuthOptions.js +59 -0
  86. package/dist/cjs/docker/options/container/ContainerCommitOptions.d.ts +28 -0
  87. package/dist/cjs/docker/options/container/ContainerCommitOptions.js +39 -0
  88. package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
  89. package/dist/cjs/docker/options/container/ContainerCreateTTYOptions.js +43 -0
  90. package/dist/cjs/docker/options/container/ContainerExecOptions.d.ts +26 -0
  91. package/dist/cjs/docker/options/container/ContainerExecOptions.js +38 -0
  92. package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
  93. package/dist/cjs/docker/options/container/ContainerExportDirectoryOptions.js +39 -0
  94. package/dist/cjs/docker/options/container/ContainerKillOptions.d.ts +25 -0
  95. package/dist/cjs/docker/options/container/ContainerKillOptions.js +36 -0
  96. package/dist/cjs/docker/options/container/ContainerLogsOptions.d.ts +48 -0
  97. package/dist/cjs/docker/options/container/ContainerLogsOptions.js +56 -0
  98. package/dist/cjs/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
  99. package/dist/cjs/docker/options/container/ContainerRemoveOptions.js +34 -0
  100. package/dist/cjs/docker/options/container/ContainerSettingOptions.d.ts +137 -0
  101. package/dist/cjs/docker/options/container/ContainerSettingOptions.js +136 -0
  102. package/dist/cjs/docker/options/container/ContainerStopOptions.d.ts +28 -0
  103. package/dist/cjs/docker/options/container/ContainerStopOptions.js +40 -0
  104. package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
  105. package/dist/cjs/docker/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
  106. package/dist/cjs/docker/options/image/ImageBuildOptions.d.ts +117 -0
  107. package/dist/cjs/docker/options/image/ImageBuildOptions.js +111 -0
  108. package/dist/cjs/docker/options/image/ImageExportOptions.d.ts +33 -0
  109. package/dist/cjs/docker/options/image/ImageExportOptions.js +44 -0
  110. package/dist/cjs/docker/options/image/ImageImportOptions.d.ts +28 -0
  111. package/dist/cjs/docker/options/image/ImageImportOptions.js +42 -0
  112. package/dist/cjs/docker/options/image/ImagePullOptions.d.ts +49 -0
  113. package/dist/cjs/docker/options/image/ImagePullOptions.js +63 -0
  114. package/dist/cjs/docker/options/image/ImagePushOptions.d.ts +41 -0
  115. package/dist/cjs/docker/options/image/ImagePushOptions.js +56 -0
  116. package/dist/cjs/docker/options/image/ImageRemoveOptions.d.ts +26 -0
  117. package/dist/cjs/docker/options/image/ImageRemoveOptions.js +38 -0
  118. package/dist/cjs/docker/options/image/ImageTagOptions.d.ts +25 -0
  119. package/dist/cjs/docker/options/image/ImageTagOptions.js +38 -0
  120. package/dist/cjs/docker/options/network/NetworkCreateOptions.d.ts +54 -0
  121. package/dist/cjs/docker/options/network/NetworkCreateOptions.js +63 -0
  122. package/dist/cjs/docker/types/ContainerBind.d.ts +19 -0
  123. package/dist/cjs/docker/types/ContainerBind.js +2 -0
  124. package/dist/cjs/docker/types/ContainerCapability.d.ts +286 -0
  125. package/dist/cjs/docker/types/ContainerCapability.js +290 -0
  126. package/dist/cjs/docker/types/ContainerConfig.d.ts +67 -0
  127. package/dist/cjs/docker/types/ContainerConfig.js +2 -0
  128. package/dist/cjs/docker/types/ContainerDevice.d.ts +19 -0
  129. package/dist/cjs/docker/types/ContainerDevice.js +2 -0
  130. package/dist/cjs/docker/types/ContainerExecResult.d.ts +20 -0
  131. package/dist/cjs/docker/types/ContainerExecResult.js +2 -0
  132. package/dist/cjs/docker/types/ContainerNetwork.d.ts +46 -0
  133. package/dist/cjs/docker/types/ContainerNetwork.js +2 -0
  134. package/dist/cjs/docker/types/ContainerPort.d.ts +25 -0
  135. package/dist/cjs/docker/types/ContainerPort.js +2 -0
  136. package/dist/cjs/docker/types/ContainerRestartPolicy.d.ts +11 -0
  137. package/dist/cjs/docker/types/ContainerRestartPolicy.js +2 -0
  138. package/dist/cjs/docker/types/ContainerState.d.ts +48 -0
  139. package/dist/cjs/docker/types/ContainerState.js +2 -0
  140. package/dist/cjs/docker/types/ContainerStats.d.ts +408 -0
  141. package/dist/cjs/docker/types/ContainerStats.js +2 -0
  142. package/dist/cjs/docker/types/DockerOutputCallback.d.ts +8 -0
  143. package/dist/cjs/docker/types/DockerOutputCallback.js +2 -0
  144. package/dist/cjs/docker/types/ImageConfig.d.ts +34 -0
  145. package/dist/cjs/docker/types/ImageConfig.js +2 -0
  146. package/dist/cjs/docker/types/ImageExposePort.d.ts +17 -0
  147. package/dist/cjs/docker/types/ImageExposePort.js +2 -0
  148. package/dist/cjs/docker/types/NetworkInfo.d.ts +59 -0
  149. package/dist/cjs/docker/types/NetworkInfo.js +2 -0
  150. package/dist/cjs/docker/types/RepositoryTag.d.ts +15 -0
  151. package/dist/cjs/docker/types/RepositoryTag.js +2 -0
  152. package/dist/cjs/exports/Docker.d.ts +73 -0
  153. package/dist/cjs/exports/Docker.js +92 -0
  154. package/dist/cjs/package.json +1 -0
  155. package/dist/esm/client/BuildContext.js +70 -0
  156. package/dist/esm/client/BuildKitProgress.js +190 -0
  157. package/dist/esm/client/DockerClient.js +307 -0
  158. package/dist/esm/client/DockerConnection.js +355 -0
  159. package/dist/esm/client/DockerIgnore.js +179 -0
  160. package/dist/esm/client/DockerRequestError.js +20 -0
  161. package/dist/esm/client/DockerStreams.js +111 -0
  162. package/dist/esm/client/types/ContainerCreateResponse.js +1 -0
  163. package/dist/esm/client/types/ContainerStopQuery.js +1 -0
  164. package/dist/esm/client/types/DeviceMapping.js +1 -0
  165. package/dist/esm/client/types/IdResponse.js +1 -0
  166. package/dist/esm/client/types/NetworkCreateResponse.js +1 -0
  167. package/dist/esm/client/types/PortBinding.js +1 -0
  168. package/dist/esm/docker/ConnectionOptionsBuilder.js +142 -0
  169. package/dist/esm/docker/Docker.js +697 -0
  170. package/dist/esm/docker/exceptions/DockerConnectionException.js +12 -0
  171. package/dist/esm/docker/exceptions/DockerContainerNotFoundException.js +12 -0
  172. package/dist/esm/docker/exceptions/DockerImageBuildException.js +12 -0
  173. package/dist/esm/docker/exceptions/DockerImageImportException.js +12 -0
  174. package/dist/esm/docker/exceptions/DockerImageNotFoundException.js +13 -0
  175. package/dist/esm/docker/exceptions/DockerImagePullException.js +12 -0
  176. package/dist/esm/docker/exceptions/DockerImagePushException.js +11 -0
  177. package/dist/esm/docker/exceptions/DockerImageRepoTagNotFoundException.js +11 -0
  178. package/dist/esm/docker/exceptions/DockerNetworkNotFoundException.js +12 -0
  179. package/dist/esm/docker/exceptions/DockerRequestException.js +20 -0
  180. package/dist/esm/docker/interfaces/IDockerConnectionOptions.js +1 -0
  181. package/dist/esm/docker/interfaces/IDockerHttpConnectionOptions.js +1 -0
  182. package/dist/esm/docker/interfaces/IDockerHttpsConnectionOptions.js +1 -0
  183. package/dist/esm/docker/interfaces/IDockerKeyObject.js +1 -0
  184. package/dist/esm/docker/interfaces/IDockerSSHConnectionOptions.js +1 -0
  185. package/dist/esm/docker/interfaces/IDockerSocketConnectionOptions.js +1 -0
  186. package/dist/esm/docker/lib/DockerContainer.js +739 -0
  187. package/dist/esm/docker/lib/DockerContainerTTY.js +154 -0
  188. package/dist/esm/docker/lib/DockerImage.js +270 -0
  189. package/dist/esm/docker/lib/EngineSettings.js +78 -0
  190. package/dist/esm/docker/lib/ParseBaseImages.js +47 -0
  191. package/dist/esm/docker/lib/ParseEnvToRecord.js +22 -0
  192. package/dist/esm/docker/lib/ParseRepositoryTag.js +45 -0
  193. package/dist/esm/docker/lib/RegistryAuth.js +12 -0
  194. package/dist/esm/docker/options/DockerPruneOptions.js +43 -0
  195. package/dist/esm/docker/options/auth/DockerAuthOptions.js +55 -0
  196. package/dist/esm/docker/options/container/ContainerCommitOptions.js +35 -0
  197. package/dist/esm/docker/options/container/ContainerCreateTTYOptions.js +39 -0
  198. package/dist/esm/docker/options/container/ContainerExecOptions.js +34 -0
  199. package/dist/esm/docker/options/container/ContainerExportDirectoryOptions.js +35 -0
  200. package/dist/esm/docker/options/container/ContainerKillOptions.js +32 -0
  201. package/dist/esm/docker/options/container/ContainerLogsOptions.js +52 -0
  202. package/dist/esm/docker/options/container/ContainerRemoveOptions.js +30 -0
  203. package/dist/esm/docker/options/container/ContainerSettingOptions.js +132 -0
  204. package/dist/esm/docker/options/container/ContainerStopOptions.js +36 -0
  205. package/dist/esm/docker/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
  206. package/dist/esm/docker/options/image/ImageBuildOptions.js +107 -0
  207. package/dist/esm/docker/options/image/ImageExportOptions.js +40 -0
  208. package/dist/esm/docker/options/image/ImageImportOptions.js +38 -0
  209. package/dist/esm/docker/options/image/ImagePullOptions.js +59 -0
  210. package/dist/esm/docker/options/image/ImagePushOptions.js +52 -0
  211. package/dist/esm/docker/options/image/ImageRemoveOptions.js +34 -0
  212. package/dist/esm/docker/options/image/ImageTagOptions.js +34 -0
  213. package/dist/esm/docker/options/network/NetworkCreateOptions.js +59 -0
  214. package/dist/esm/docker/types/ContainerBind.js +1 -0
  215. package/dist/esm/docker/types/ContainerCapability.js +287 -0
  216. package/dist/esm/docker/types/ContainerConfig.js +1 -0
  217. package/dist/esm/docker/types/ContainerDevice.js +1 -0
  218. package/dist/esm/docker/types/ContainerExecResult.js +1 -0
  219. package/dist/esm/docker/types/ContainerNetwork.js +1 -0
  220. package/dist/esm/docker/types/ContainerPort.js +1 -0
  221. package/dist/esm/docker/types/ContainerRestartPolicy.js +1 -0
  222. package/dist/esm/docker/types/ContainerState.js +1 -0
  223. package/dist/esm/docker/types/ContainerStats.js +1 -0
  224. package/dist/esm/docker/types/DockerOutputCallback.js +1 -0
  225. package/dist/esm/docker/types/ImageConfig.js +1 -0
  226. package/dist/esm/docker/types/ImageExposePort.js +1 -0
  227. package/dist/esm/docker/types/NetworkInfo.js +1 -0
  228. package/dist/esm/docker/types/RepositoryTag.js +1 -0
  229. package/dist/esm/exports/Docker.js +73 -0
  230. package/dist/types/client/BuildContext.d.ts +22 -0
  231. package/dist/types/client/BuildKitProgress.d.ts +81 -0
  232. package/dist/types/client/DockerClient.d.ts +196 -0
  233. package/dist/types/client/DockerConnection.d.ts +154 -0
  234. package/dist/types/client/DockerIgnore.d.ts +44 -0
  235. package/dist/types/client/DockerRequestError.d.ts +17 -0
  236. package/dist/types/client/DockerStreams.d.ts +35 -0
  237. package/dist/types/client/types/ContainerCreateResponse.d.ts +7 -0
  238. package/dist/types/client/types/ContainerStopQuery.d.ts +13 -0
  239. package/dist/types/client/types/DeviceMapping.d.ts +8 -0
  240. package/dist/types/client/types/IdResponse.d.ts +6 -0
  241. package/dist/types/client/types/NetworkCreateResponse.d.ts +7 -0
  242. package/dist/types/client/types/PortBinding.d.ts +10 -0
  243. package/dist/types/docker/ConnectionOptionsBuilder.d.ts +128 -0
  244. package/dist/types/docker/Docker.d.ts +301 -0
  245. package/dist/types/docker/exceptions/DockerConnectionException.d.ts +9 -0
  246. package/dist/types/docker/exceptions/DockerContainerNotFoundException.d.ts +9 -0
  247. package/dist/types/docker/exceptions/DockerImageBuildException.d.ts +9 -0
  248. package/dist/types/docker/exceptions/DockerImageImportException.d.ts +9 -0
  249. package/dist/types/docker/exceptions/DockerImageNotFoundException.d.ts +10 -0
  250. package/dist/types/docker/exceptions/DockerImagePullException.d.ts +9 -0
  251. package/dist/types/docker/exceptions/DockerImagePushException.d.ts +8 -0
  252. package/dist/types/docker/exceptions/DockerImageRepoTagNotFoundException.d.ts +8 -0
  253. package/dist/types/docker/exceptions/DockerNetworkNotFoundException.d.ts +9 -0
  254. package/dist/types/docker/exceptions/DockerRequestException.d.ts +22 -0
  255. package/dist/types/docker/interfaces/IDockerConnectionOptions.d.ts +75 -0
  256. package/dist/types/docker/interfaces/IDockerHttpConnectionOptions.d.ts +16 -0
  257. package/dist/types/docker/interfaces/IDockerHttpsConnectionOptions.d.ts +16 -0
  258. package/dist/types/docker/interfaces/IDockerKeyObject.d.ts +14 -0
  259. package/dist/types/docker/interfaces/IDockerSSHConnectionOptions.d.ts +16 -0
  260. package/dist/types/docker/interfaces/IDockerSocketConnectionOptions.d.ts +7 -0
  261. package/dist/types/docker/lib/DockerContainer.d.ts +315 -0
  262. package/dist/types/docker/lib/DockerContainerTTY.d.ts +99 -0
  263. package/dist/types/docker/lib/DockerImage.d.ts +153 -0
  264. package/dist/types/docker/lib/EngineSettings.d.ts +41 -0
  265. package/dist/types/docker/lib/ParseBaseImages.d.ts +9 -0
  266. package/dist/types/docker/lib/ParseEnvToRecord.d.ts +14 -0
  267. package/dist/types/docker/lib/ParseRepositoryTag.d.ts +17 -0
  268. package/dist/types/docker/lib/RegistryAuth.d.ts +8 -0
  269. package/dist/types/docker/options/DockerPruneOptions.d.ts +38 -0
  270. package/dist/types/docker/options/auth/DockerAuthOptions.d.ts +46 -0
  271. package/dist/types/docker/options/container/ContainerCommitOptions.d.ts +28 -0
  272. package/dist/types/docker/options/container/ContainerCreateTTYOptions.d.ts +32 -0
  273. package/dist/types/docker/options/container/ContainerExecOptions.d.ts +26 -0
  274. package/dist/types/docker/options/container/ContainerExportDirectoryOptions.d.ts +27 -0
  275. package/dist/types/docker/options/container/ContainerKillOptions.d.ts +25 -0
  276. package/dist/types/docker/options/container/ContainerLogsOptions.d.ts +48 -0
  277. package/dist/types/docker/options/container/ContainerRemoveOptions.d.ts +22 -0
  278. package/dist/types/docker/options/container/ContainerSettingOptions.d.ts +137 -0
  279. package/dist/types/docker/options/container/ContainerStopOptions.d.ts +28 -0
  280. package/dist/types/docker/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
  281. package/dist/types/docker/options/image/ImageBuildOptions.d.ts +117 -0
  282. package/dist/types/docker/options/image/ImageExportOptions.d.ts +33 -0
  283. package/dist/types/docker/options/image/ImageImportOptions.d.ts +28 -0
  284. package/dist/types/docker/options/image/ImagePullOptions.d.ts +49 -0
  285. package/dist/types/docker/options/image/ImagePushOptions.d.ts +41 -0
  286. package/dist/types/docker/options/image/ImageRemoveOptions.d.ts +26 -0
  287. package/dist/types/docker/options/image/ImageTagOptions.d.ts +25 -0
  288. package/dist/types/docker/options/network/NetworkCreateOptions.d.ts +54 -0
  289. package/dist/types/docker/types/ContainerBind.d.ts +19 -0
  290. package/dist/types/docker/types/ContainerCapability.d.ts +286 -0
  291. package/dist/types/docker/types/ContainerConfig.d.ts +67 -0
  292. package/dist/types/docker/types/ContainerDevice.d.ts +19 -0
  293. package/dist/types/docker/types/ContainerExecResult.d.ts +20 -0
  294. package/dist/types/docker/types/ContainerNetwork.d.ts +46 -0
  295. package/dist/types/docker/types/ContainerPort.d.ts +25 -0
  296. package/dist/types/docker/types/ContainerRestartPolicy.d.ts +11 -0
  297. package/dist/types/docker/types/ContainerState.d.ts +48 -0
  298. package/dist/types/docker/types/ContainerStats.d.ts +408 -0
  299. package/dist/types/docker/types/DockerOutputCallback.d.ts +8 -0
  300. package/dist/types/docker/types/ImageConfig.d.ts +34 -0
  301. package/dist/types/docker/types/ImageExposePort.d.ts +17 -0
  302. package/dist/types/docker/types/NetworkInfo.d.ts +59 -0
  303. package/dist/types/docker/types/RepositoryTag.d.ts +15 -0
  304. package/dist/types/exports/Docker.d.ts +73 -0
  305. package/package.json +57 -0
@@ -0,0 +1,99 @@
1
+ import { Provider } from '@lakutata/core';
2
+ import stream from 'stream';
3
+ import type { DockerClient } from '../../client/DockerClient.js';
4
+ import { ContainerTTYConsoleSizeOptions } from '../options/container/ContainerTTYConsoleSizeOptions.js';
5
+ /**
6
+ * An interactive command running with a TTY in a container, as `docker exec -it`: what is written to it is the
7
+ * command's input, its output (stdout and stderr together, with the terminal's control sequences) is read from it. It is
8
+ * not created with `new`: {@link DockerContainer.createTTY} returns it, its command started.
9
+ *
10
+ * The command runs until it exits (`exit` written to a shell), or until the stream is closed (`tty.raw.end()`,
11
+ * `tty.raw.destroy()`); the stream then ends. A command which cannot be started (not found in the image) does not fail
12
+ * the creation: its error message is the output, then the stream ends. The write failures are logged by the
13
+ * application's `log` component, else by the console.
14
+ * @example
15
+ * ```typescript
16
+ * import {type DockerContainer, type DockerContainerTTY} from 'lakutata/com/docker'
17
+ *
18
+ * declare const container: DockerContainer
19
+ *
20
+ * //A shell: /bin/sh by default
21
+ * const tty: DockerContainerTTY = await container.createTTY({consoleSize: {cols: 120, rows: 40}})
22
+ * tty.onData((chunk: Buffer): void => {
23
+ * process.stdout.write(chunk)
24
+ * })
25
+ * tty.raw.once('end', (): void => console.log('The shell exited'))
26
+ * tty.write('ls -l /\n')
27
+ * await tty.resize({cols: 160, rows: 50})
28
+ * tty.write('exit\n')
29
+ * ```
30
+ */
31
+ export declare class DockerContainerTTY extends Provider {
32
+ #private;
33
+ /**
34
+ * Give the client of the Engine API: set by the {@link DockerContainer} creating the object.
35
+ */
36
+ protected readonly getClient: () => DockerClient;
37
+ /**
38
+ * The full ID of the container running the command.
39
+ */
40
+ protected readonly containerId: string;
41
+ /**
42
+ * The command run: the program and its arguments (a program name alone as a string).
43
+ */
44
+ protected readonly cmd: string | string[];
45
+ /**
46
+ * The size of the console when the command starts.
47
+ * @default undefined (chosen by the daemon)
48
+ */
49
+ protected readonly initialConsoleSize?: ContainerTTYConsoleSizeOptions;
50
+ /**
51
+ * Create the execution of the command and start it, attached to its TTY.
52
+ * @throws {DockerContainerNotFoundException} When the container was removed.
53
+ * @throws {DockerRequestException} When the container is not running (HTTP 409).
54
+ * @protected
55
+ */
56
+ protected init(): Promise<void>;
57
+ /**
58
+ * Close the stream of the TTY, which ends the command's input.
59
+ * @protected
60
+ */
61
+ protected destroy(): Promise<void>;
62
+ /**
63
+ * The stream of the TTY, both ways: written, the command's input; read, its output. Its `end` event tells that the
64
+ * command exited, once its output is read (with {@link DockerContainerTTY.onData} or a `data` listener).
65
+ */
66
+ get raw(): stream.Duplex;
67
+ /**
68
+ * The stream of the TTY, typed as its writable side: the command's input.
69
+ */
70
+ get writable(): stream.Writable;
71
+ /**
72
+ * The stream of the TTY, typed as its readable side: the command's output.
73
+ */
74
+ get readable(): stream.Readable;
75
+ /**
76
+ * Change the size of the TTY's console, as a terminal window resized does (the command gets `SIGWINCH`).
77
+ * @param options The number of columns (`cols`) and rows (`rows`).
78
+ * @throws {DockerRequestException} When the command has exited (HTTP 404, no such exec; HTTP 500).
79
+ * @throws {DockerContainerNotFoundException} When the container was removed.
80
+ */
81
+ resize(options: ContainerTTYConsoleSizeOptions): Promise<void>;
82
+ /**
83
+ * Receive the command's output as it comes. Each call adds a handler.
84
+ * @param handler Called with each chunk of the output: raw bytes, the terminal's control sequences included.
85
+ */
86
+ onData(handler: (chunk: Buffer) => void): void;
87
+ /**
88
+ * Write text to the command's input, as typed on its terminal (`'ls\n'` runs `ls` in a shell). A write failure is
89
+ * not thrown: it is logged as a warning by the `log` component (by the console without it).
90
+ * @param data The text written, UTF-8 encoded.
91
+ */
92
+ write(data: string): void;
93
+ /**
94
+ * Write bytes to the command's input, as typed on its terminal. A write failure is not thrown: it is logged as a
95
+ * warning by the `log` component (by the console without it).
96
+ * @param data The bytes written.
97
+ */
98
+ write(data: Buffer): void;
99
+ }
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DockerContainerTTY = void 0;
13
+ const core_1 = require("@lakutata/core");
14
+ const di_1 = require("@lakutata/core/decorator/di");
15
+ const ContainerTTYConsoleSizeOptions_js_1 = require("../options/container/ContainerTTYConsoleSizeOptions.js");
16
+ const dto_1 = require("@lakutata/core/decorator/dto");
17
+ /**
18
+ * An interactive command running with a TTY in a container, as `docker exec -it`: what is written to it is the
19
+ * command's input, its output (stdout and stderr together, with the terminal's control sequences) is read from it. It is
20
+ * not created with `new`: {@link DockerContainer.createTTY} returns it, its command started.
21
+ *
22
+ * The command runs until it exits (`exit` written to a shell), or until the stream is closed (`tty.raw.end()`,
23
+ * `tty.raw.destroy()`); the stream then ends. A command which cannot be started (not found in the image) does not fail
24
+ * the creation: its error message is the output, then the stream ends. The write failures are logged by the
25
+ * application's `log` component, else by the console.
26
+ * @example
27
+ * ```typescript
28
+ * import {type DockerContainer, type DockerContainerTTY} from 'lakutata/com/docker'
29
+ *
30
+ * declare const container: DockerContainer
31
+ *
32
+ * //A shell: /bin/sh by default
33
+ * const tty: DockerContainerTTY = await container.createTTY({consoleSize: {cols: 120, rows: 40}})
34
+ * tty.onData((chunk: Buffer): void => {
35
+ * process.stdout.write(chunk)
36
+ * })
37
+ * tty.raw.once('end', (): void => console.log('The shell exited'))
38
+ * tty.write('ls -l /\n')
39
+ * await tty.resize({cols: 160, rows: 50})
40
+ * tty.write('exit\n')
41
+ * ```
42
+ */
43
+ let DockerContainerTTY = class DockerContainerTTY extends core_1.Provider {
44
+ #execId;
45
+ #duplexStream;
46
+ /**
47
+ * The logger of the write failures: the application's log component, else the console
48
+ */
49
+ #log;
50
+ /**
51
+ * Create the execution of the command and start it, attached to its TTY.
52
+ * @throws {DockerContainerNotFoundException} When the container was removed.
53
+ * @throws {DockerRequestException} When the container is not running (HTTP 409).
54
+ * @protected
55
+ */
56
+ async init() {
57
+ try {
58
+ this.#log = await this.getObject('log');
59
+ }
60
+ catch {
61
+ //An application without a log component
62
+ this.#log = console;
63
+ }
64
+ const exec = await this.getClient().createExec(this.containerId, {
65
+ AttachStderr: true,
66
+ AttachStdin: true,
67
+ AttachStdout: true,
68
+ Cmd: this.cmd ? Array.isArray(this.cmd) ? this.cmd : [this.cmd] : undefined,
69
+ Tty: true,
70
+ ConsoleSize: [this.initialConsoleSize?.rows ? this.initialConsoleSize.rows : 0, this.initialConsoleSize?.cols ? this.initialConsoleSize.cols : 0]
71
+ });
72
+ this.#execId = exec.Id;
73
+ //Started with its TTY: its output is not multiplexed
74
+ this.#duplexStream = await this.getClient().startExec(this.#execId, { Detach: false, Tty: true });
75
+ }
76
+ /**
77
+ * Close the stream of the TTY, which ends the command's input.
78
+ * @protected
79
+ */
80
+ async destroy() {
81
+ //Not created when its execution failed to start
82
+ if (this.#duplexStream && !this.#duplexStream.destroyed) {
83
+ this.#duplexStream.removeAllListeners();
84
+ this.#duplexStream.destroy();
85
+ }
86
+ }
87
+ /**
88
+ * The stream of the TTY, both ways: written, the command's input; read, its output. Its `end` event tells that the
89
+ * command exited, once its output is read (with {@link DockerContainerTTY.onData} or a `data` listener).
90
+ */
91
+ get raw() {
92
+ return this.#duplexStream;
93
+ }
94
+ /**
95
+ * The stream of the TTY, typed as its writable side: the command's input.
96
+ */
97
+ get writable() {
98
+ return this.#duplexStream;
99
+ }
100
+ /**
101
+ * The stream of the TTY, typed as its readable side: the command's output.
102
+ */
103
+ get readable() {
104
+ return this.#duplexStream;
105
+ }
106
+ /**
107
+ * Change the size of the TTY's console, as a terminal window resized does (the command gets `SIGWINCH`).
108
+ * @param options The number of columns (`cols`) and rows (`rows`).
109
+ * @throws {DockerRequestException} When the command has exited (HTTP 404, no such exec; HTTP 500).
110
+ * @throws {DockerContainerNotFoundException} When the container was removed.
111
+ */
112
+ async resize(options) {
113
+ await this.getClient().resizeExec(this.#execId, {
114
+ w: options.cols,
115
+ h: options.rows
116
+ });
117
+ }
118
+ /**
119
+ * Receive the command's output as it comes. Each call adds a handler.
120
+ * @param handler Called with each chunk of the output: raw bytes, the terminal's control sequences included.
121
+ */
122
+ onData(handler) {
123
+ this.#duplexStream.on('data', handler);
124
+ }
125
+ write(data) {
126
+ this.#duplexStream.write(data, (error) => {
127
+ if (error)
128
+ this.#log.warn('Write data to duplex stream error: %s', error.message);
129
+ });
130
+ }
131
+ };
132
+ exports.DockerContainerTTY = DockerContainerTTY;
133
+ __decorate([
134
+ (0, di_1.Configurable)(core_1.DTO.Function()),
135
+ __metadata("design:type", Function)
136
+ ], DockerContainerTTY.prototype, "getClient", void 0);
137
+ __decorate([
138
+ (0, di_1.Configurable)(core_1.DTO.String()),
139
+ __metadata("design:type", String)
140
+ ], DockerContainerTTY.prototype, "containerId", void 0);
141
+ __decorate([
142
+ (0, di_1.Configurable)(core_1.DTO.Alternatives(core_1.DTO.String(), core_1.DTO.Array(core_1.DTO.String()).min(1))),
143
+ __metadata("design:type", Object)
144
+ ], DockerContainerTTY.prototype, "cmd", void 0);
145
+ __decorate([
146
+ (0, di_1.Configurable)(ContainerTTYConsoleSizeOptions_js_1.ContainerTTYConsoleSizeOptions.optional()),
147
+ __metadata("design:type", ContainerTTYConsoleSizeOptions_js_1.ContainerTTYConsoleSizeOptions)
148
+ ], DockerContainerTTY.prototype, "initialConsoleSize", void 0);
149
+ __decorate([
150
+ (0, dto_1.Accept)(ContainerTTYConsoleSizeOptions_js_1.ContainerTTYConsoleSizeOptions.required()),
151
+ __metadata("design:type", Function),
152
+ __metadata("design:paramtypes", [ContainerTTYConsoleSizeOptions_js_1.ContainerTTYConsoleSizeOptions]),
153
+ __metadata("design:returntype", Promise)
154
+ ], DockerContainerTTY.prototype, "resize", null);
155
+ exports.DockerContainerTTY = DockerContainerTTY = __decorate([
156
+ (0, di_1.Transient)()
157
+ ], DockerContainerTTY);
@@ -0,0 +1,153 @@
1
+ import { Provider } from '@lakutata/core';
2
+ import type { DockerClient } from '../../client/DockerClient.js';
3
+ import { Time } from '@lakutata/utils/Time';
4
+ import { ImageConfig } from '../types/ImageConfig.js';
5
+ import { ImageTagOptions } from '../options/image/ImageTagOptions.js';
6
+ import { ImageExportOptions } from '../options/image/ImageExportOptions.js';
7
+ import { ImageRemoveOptions } from '../options/image/ImageRemoveOptions.js';
8
+ import { ImagePushOptions } from '../options/image/ImagePushOptions.js';
9
+ import type { Docker } from '../Docker.js';
10
+ import { ContainerSettingOptions } from '../options/container/ContainerSettingOptions.js';
11
+ import { type DockerContainer } from './DockerContainer.js';
12
+ /**
13
+ * An image of the Docker daemon, with its tags, platform, size and configuration as inspected, and its operations: tag,
14
+ * export, push, remove, and run a container. It is not created with `new`: {@link Docker.getImage},
15
+ * {@link Docker.listImages}, {@link Docker.pullImage}, {@link Docker.buildImage}, {@link Docker.importImage} and
16
+ * {@link DockerContainer.commit} return it.
17
+ *
18
+ * Its properties are a snapshot, taken when it is obtained and refreshed by `tag()` and `push()`. Its operations reject
19
+ * with {@link DockerImageNotFoundException} when the image was removed, with {@link DockerRequestException} when the
20
+ * daemon refuses them otherwise (used by a container: HTTP 409), and with the network error of Node.js when the daemon
21
+ * cannot be reached.
22
+ * @example
23
+ * ```typescript
24
+ * import {type Docker, type DockerContainer, type DockerImage} from 'lakutata/com/docker'
25
+ *
26
+ * declare const docker: Docker
27
+ *
28
+ * const image: DockerImage = await docker.buildImage({workdir: '/srv/app', files: ['Dockerfile', 'src', 'package.json'], repoTag: 'app:1.0.0'})
29
+ * console.log(image.id, image.platform, image.size, image.config.ports)
30
+ * await image.tag({repo: 'registry.example.com/team/app', tag: '1.0.0'})
31
+ * await image.push({
32
+ * repo: 'registry.example.com/team/app',
33
+ * tag: '1.0.0',
34
+ * auth: {serverAddress: 'registry.example.com', username: 'ci', password: 'secret'}
35
+ * })
36
+ * await image.export({destination: '/tmp/app-1.0.0.tar', repoTag: 'app:1.0.0'})
37
+ * const container: DockerContainer = await image.run({name: 'app', ports: [{port: 3000, type: 'tcp', hostPorts: [3000]}]})
38
+ * console.log(container.state.status)
39
+ * ```
40
+ */
41
+ export declare class DockerImage extends Provider {
42
+ #private;
43
+ /**
44
+ * Give the client of the Engine API: set by the {@link Docker} component creating the object.
45
+ */
46
+ protected readonly getClient: () => DockerClient;
47
+ /**
48
+ * Give the {@link Docker} component which created the object.
49
+ */
50
+ protected readonly getDocker: () => Docker;
51
+ /**
52
+ * The full ID of the image (`sha256:…`).
53
+ */
54
+ id: string;
55
+ /**
56
+ * The tags of the image (`['alpine:3.20', 'alpine:latest']`); empty for an untagged image.
57
+ */
58
+ repoTags: string[];
59
+ /**
60
+ * When the image was built.
61
+ */
62
+ createdAt: Time;
63
+ /**
64
+ * The CPU architecture of the image (`amd64`, `arm64`).
65
+ */
66
+ arch: string;
67
+ /**
68
+ * The operating system of the image (`linux`).
69
+ */
70
+ os: string;
71
+ /**
72
+ * The platform of the image, `os/arch` (`linux/arm64`): the one its containers are created for by
73
+ * {@link DockerImage.run}.
74
+ */
75
+ platform: string;
76
+ /**
77
+ * The size of the image, in bytes.
78
+ */
79
+ size: number;
80
+ /**
81
+ * The configuration of the image: its default host name, user, environment, command, entrypoint, volumes and exposed
82
+ * ports.
83
+ */
84
+ config: ImageConfig;
85
+ /**
86
+ * Inspect the image.
87
+ * @throws {DockerImageNotFoundException} When the image does not exist.
88
+ * @protected
89
+ */
90
+ protected init(): Promise<void>;
91
+ /**
92
+ * Abort the export in progress of the object (the image itself is left as it is).
93
+ * @protected
94
+ */
95
+ protected destroy(): Promise<void>;
96
+ /**
97
+ * Refresh the properties from the daemon's inspection of the image.
98
+ * @throws {DockerImageNotFoundException} When the image does not exist.
99
+ * @protected
100
+ */
101
+ protected syncImageInfo(): Promise<void>;
102
+ /**
103
+ * Add a tag to the image, as `docker tag`, then refresh its properties. A tag already given to another image moves to
104
+ * this one.
105
+ * @param options The repository (`registry.example.com/team/app`) and the tag (`latest` by default).
106
+ * @throws {DockerImageNotFoundException} When the image was removed.
107
+ * @throws {DockerRequestException} When the name is invalid (HTTP 400).
108
+ */
109
+ tag(options: ImageTagOptions): Promise<void>;
110
+ /**
111
+ * Save the image as a tar archive, as `docker save`, which {@link Docker.importImage} loads. With `repoTag`, the
112
+ * archive holds that tag (restored when it is loaded); without it, the image is saved by ID, without its tags.
113
+ * @param options The `destination` (a file path, created or overwritten, or a writable stream, ended after the
114
+ * archive), the tag saved (`repoTag`), and `createRepoTagIfNotExists` (`true` by default) to add that tag to the image
115
+ * when it does not have it.
116
+ * @throws {DockerImageRepoTagNotFoundException} When the image does not have `repoTag` and
117
+ * `createRepoTagIfNotExists` is `false`.
118
+ * @throws {DockerImageNotFoundException} When the image was removed.
119
+ * @throws {Error} The error of the destination.
120
+ */
121
+ export(options: ImageExportOptions): Promise<void>;
122
+ /**
123
+ * Push the image to its registry, as `docker push`, and wait for its end. The image is first tagged `repo:tag` (the
124
+ * tag is kept afterwards).
125
+ * @param options The repository, with its registry (`registry.example.com/team/app`); the tag (`latest` by default);
126
+ * the registry credentials; and a callback receiving each progress message.
127
+ * @throws {DockerImagePushException} When the registry refuses the push (refused credentials, a repository not
128
+ * found).
129
+ * @throws {DockerImageNotFoundException} When the image was removed.
130
+ * @throws {DockerRequestException} When the daemon refuses to push it.
131
+ */
132
+ push(options: ImagePushOptions): Promise<void>;
133
+ /**
134
+ * Remove the image, as `docker rmi -f` by default: forced, it is removed with all its tags, even when a stopped
135
+ * container uses it.
136
+ * @param options `force` (`true` by default; `false` refuses an image with several tags or used by a container) and
137
+ * `noprune` (keeps its untagged parent images; `false` by default).
138
+ * @throws {DockerImageNotFoundException} When the image was already removed.
139
+ * @throws {DockerRequestException} When it is used by a running container or, without `force`, by any container or
140
+ * with several tags (HTTP 409).
141
+ */
142
+ remove(options?: ImageRemoveOptions): Promise<void>;
143
+ /**
144
+ * Create a container from the image, for its platform, then start it, as `docker run -d`.
145
+ * @param options The container's settings: name, command, environment, ports, binds, devices, networks, limits…
146
+ * @returns The container, started.
147
+ * @throws {DockerRequestException} When the name is already used (HTTP 409), or the start fails (HTTP 500: a command
148
+ * not found, a port already used); the container then stays created.
149
+ * @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
150
+ * @throws {InvalidMethodAcceptException} When the settings are invalid.
151
+ */
152
+ run(options: ContainerSettingOptions): Promise<DockerContainer>;
153
+ }