@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,301 @@
1
+ import { Component } from '@lakutata/core';
2
+ import { DockerImage } from './lib/DockerImage.js';
3
+ import { DockerContainer } from './lib/DockerContainer.js';
4
+ import { ImagePullOptions } from './options/image/ImagePullOptions.js';
5
+ import { ImageBuildOptions } from './options/image/ImageBuildOptions.js';
6
+ import { IDockerKeyObject } from './interfaces/IDockerKeyObject.js';
7
+ import { ImageImportOptions } from './options/image/ImageImportOptions.js';
8
+ import { NetworkCreateOptions } from './options/network/NetworkCreateOptions.js';
9
+ import { NetworkInfo } from './types/NetworkInfo.js';
10
+ import { ContainerSettingOptions } from './options/container/ContainerSettingOptions.js';
11
+ import { DockerPruneOptions } from './options/DockerPruneOptions.js';
12
+ import { DockerAuthOptions } from './options/auth/DockerAuthOptions.js';
13
+ /**
14
+ * The Docker component: drives a Docker daemon over the Docker Engine API, to pull, build, import, export, tag and push
15
+ * images, to create, run and manage containers (exec, TTYs, logs, stats, commit, archives) and to manage networks.
16
+ * Register it in the `components` of an application (`{class: Docker}`, or the result of one of the
17
+ * `BuildDocker*ConnectionOptions` functions) and get it with `getObject()` or `@Inject`; it is a singleton.
18
+ *
19
+ * Without `socketPath` nor `host`, it connects to the Docker of the environment: `DOCKER_HOST` (with
20
+ * `DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH` and `DOCKER_CLIENT_TIMEOUT`), else the named pipe `//./pipe/docker_engine` on
21
+ * Windows, the socket of Docker Desktop (`~/.docker/run/docker.sock`) when it exists, or `/var/run/docker.sock`; the
22
+ * other options given (`timeout`, `headers`, `version`…) apply over the environment's. No Docker CLI is needed locally
23
+ * (the SSH connections need it on the remote host).
24
+ *
25
+ * When it is created, the component pings the daemon and negotiates the API version (the newest one supported by both,
26
+ * from 1.41 to 1.56): a daemon which cannot be reached fails its creation with {@link DockerConnectionException}.
27
+ * Afterwards, a daemon which cannot be reached rejects the calls with the network error of Node.js (`ECONNREFUSED`,
28
+ * `ENOENT`…). A request the daemon refuses rejects with the exception of what is missing
29
+ * ({@link DockerContainerNotFoundException}, {@link DockerImageNotFoundException},
30
+ * {@link DockerNetworkNotFoundException}), else with a {@link DockerRequestException}, whose `statusCode` is the HTTP
31
+ * status and whose message is the daemon's. The pulls, builds, imports and pushes wrap their failures in their own
32
+ * exceptions ({@link DockerImagePullException}…).
33
+ *
34
+ * When the component is destroyed (the application stopping), the pulls and builds in progress are aborted (they reject
35
+ * with their exception), the listings in progress resolve with an empty list, and its connections are closed.
36
+ * @example
37
+ * ```typescript
38
+ * import {Application} from 'lakutata'
39
+ * import {Docker, type DockerContainer, type DockerImage} from 'lakutata/com/docker'
40
+ *
41
+ * Application
42
+ * .run(() => ({
43
+ * id: 'docker.app',
44
+ * name: 'Docker',
45
+ * components: {
46
+ * //The Docker of the environment: DOCKER_HOST, else the local socket
47
+ * docker: {class: Docker}
48
+ * }
49
+ * }))
50
+ * .onLaunched(async (app: Application): Promise<void> => {
51
+ * const docker: Docker = await app.getObject('docker')
52
+ * const image: DockerImage = await docker.pullImage({repo: 'alpine', tag: '3.20'})
53
+ * //Created, then started
54
+ * const container: DockerContainer = await image.run({name: 'hello', cmd: ['sleep', '60']})
55
+ * console.log((await container.exec({cmd: ['echo', 'hello']})).stdout)
56
+ * await container.remove({force: true})
57
+ * })
58
+ * ```
59
+ */
60
+ export declare class Docker extends Component {
61
+ #private;
62
+ /**
63
+ * The path of the daemon's Unix socket (`/var/run/docker.sock`), or of its named pipe on Windows
64
+ * (`//./pipe/docker_engine`). When set, `host` and `port` are ignored.
65
+ * @default undefined (the Docker of the environment, see {@link Docker})
66
+ */
67
+ protected readonly socketPath?: string | undefined;
68
+ /**
69
+ * The host name or IP address of the daemon, reached over TCP (`protocol` `'http'` or `'https'`) or SSH
70
+ * (`'ssh'`).
71
+ * @default undefined (the Docker of the environment, see {@link Docker})
72
+ */
73
+ protected readonly host?: string | undefined;
74
+ /**
75
+ * The port of the daemon on `host`: by convention 2375 over HTTP and 2376 over HTTPS; the SSH port for `'ssh'`.
76
+ * @default undefined (80 over HTTP, 443 over HTTPS, 22 over SSH)
77
+ */
78
+ protected readonly port?: number | string | undefined;
79
+ /**
80
+ * The user of the SSH connections. There is no password: the SSH connection authenticates through the SSH agent
81
+ * (see `sshAuthAgent`).
82
+ * @default undefined
83
+ */
84
+ protected readonly username?: string | undefined;
85
+ /**
86
+ * The HTTP headers added to every request sent to the daemon (a proxy's credentials…), the Docker of the
87
+ * environment's included.
88
+ * @default undefined
89
+ */
90
+ protected readonly headers?: {
91
+ [name: string]: string;
92
+ };
93
+ /**
94
+ * The certificates of the authorities trusted for the daemon's HTTPS certificate: their PEM contents, not their file
95
+ * paths.
96
+ * @default undefined (the authorities of Node.js)
97
+ */
98
+ protected readonly ca?: string | string[] | Buffer | Buffer[] | undefined;
99
+ /**
100
+ * The client certificate of the HTTPS connections (its PEM contents), for a daemon verifying its clients
101
+ * (`--tlsverify`).
102
+ * @default undefined
103
+ */
104
+ protected readonly cert?: string | string[] | Buffer | Buffer[] | undefined;
105
+ /**
106
+ * The private key of `cert` (its PEM contents), or keys with their passphrases ({@link IDockerKeyObject}).
107
+ * @default undefined
108
+ */
109
+ protected readonly key?: string | string[] | Buffer | Buffer[] | IDockerKeyObject[] | undefined;
110
+ /**
111
+ * How `host` is reached: `'http'`, `'https'` (with `ca`, `cert` and `key`), or `'ssh'`. Over SSH, the requests
112
+ * go through `docker system dial-stdio` run on the remote host (which needs the Docker CLI), and the optional package
113
+ * `ssh2` must be installed, otherwise the component's creation fails with {@link DockerConnectionException}.
114
+ * Ignored with `socketPath`.
115
+ * @default 'https' when `ca`, `cert` and `key` are all given, 'http' otherwise
116
+ */
117
+ protected readonly protocol?: 'https' | 'http' | 'ssh' | undefined;
118
+ /**
119
+ * How long a request may stay idle (no data received), in milliseconds; the request then fails with the error
120
+ * "Timeout of … ms exceeded". It also applies to the streams (a followed log with no output for that long fails),
121
+ * and to the Docker of the environment (over its `DOCKER_CLIENT_TIMEOUT`).
122
+ * @default undefined (no timeout, or the environment's `DOCKER_CLIENT_TIMEOUT`)
123
+ */
124
+ protected readonly timeout?: number | undefined;
125
+ /**
126
+ * The version of the Docker Engine API used by the requests (`'1.47'` or `'v1.47'`).
127
+ * @default undefined (negotiated with the daemon: the newest version both support)
128
+ */
129
+ protected readonly version?: string | undefined;
130
+ /**
131
+ * The path of the SSH agent's socket, which authenticates the SSH connections.
132
+ * @default undefined (the `SSH_AUTH_SOCK` environment variable)
133
+ */
134
+ protected readonly sshAuthAgent?: string | undefined;
135
+ /**
136
+ * Connect to the daemon: ping it, then negotiate the API version.
137
+ * @throws {DockerConnectionException} When the daemon cannot be reached or does not answer, or when an SSH
138
+ * connection is configured without the package `ssh2`.
139
+ * @protected
140
+ */
141
+ protected init(): Promise<void>;
142
+ /**
143
+ * Abort the pulls, builds and listings in progress (the pulls and builds then reject), then close the connections
144
+ * to the daemon.
145
+ * @protected
146
+ */
147
+ protected destroy(): Promise<void>;
148
+ /** Docker Common Operations **/
149
+ /**
150
+ * Remove the daemon's unused resources, as `docker <kind> prune` does without options: the stopped containers, then
151
+ * the dangling images (untagged and unused), the unused networks and the unused anonymous volumes. Without
152
+ * options, the containers and the images are pruned; the networks and the volumes only when asked.
153
+ * @param options The kinds of resources pruned: `containers` and `images` default to `true`, `networks` and
154
+ * `volumes` to `false`.
155
+ * @throws {InvalidMethodAcceptException} When the options are invalid.
156
+ * @throws {DockerRequestException} When the daemon refuses a prune (one already running: HTTP 409).
157
+ */
158
+ prune(options?: DockerPruneOptions): Promise<void>;
159
+ /**
160
+ * Check credentials against a registry, as `docker login` does. The credentials are not kept: each pull, build or
161
+ * push which needs them is given its own `auth`.
162
+ * @param options The registry (`serverAddress`, a host name without protocol: `registry.example.com:5000`) and its
163
+ * credentials (a password, or a token).
164
+ * @throws {DockerRequestException} When the registry refuses the credentials or cannot be reached (the daemon's
165
+ * status: HTTP 401, 500).
166
+ */
167
+ loginRepository(options: DockerAuthOptions): Promise<void>;
168
+ /**
169
+ * Whether a registry accepts credentials ({@link Docker.loginRepository} without its error).
170
+ * @param options The registry (`serverAddress`, a host name without protocol) and its credentials.
171
+ * @returns `true` when they are accepted; `false` on any failure, the daemon unreachable included.
172
+ */
173
+ checkRepositoryAuth(options: DockerAuthOptions): Promise<boolean>;
174
+ /** Docker Image Operations **/
175
+ /**
176
+ * List the daemon's images (as `docker images`, without the intermediate ones). Each image is inspected with a request
177
+ * of its own, so the call costs one request per image; an image removed during the listing is not listed.
178
+ * @returns The images, in the daemon's order.
179
+ */
180
+ listImages(): Promise<DockerImage[]>;
181
+ /**
182
+ * Pull an image from its registry, as `docker pull`, and wait for its end.
183
+ * @param options The repository (`alpine`, `registry.example.com:5000/team/app`), the tag (`'latest'` by default),
184
+ * the platform (`linux/arm64`, the daemon's by default), the registry credentials, and a callback receiving each
185
+ * progress message.
186
+ * @returns The image pulled, found as `repo:tag` the way the daemon names it (`docker.io/library/alpine` is
187
+ * `alpine`).
188
+ * @throws {DockerImagePullException} When the pull fails: the image or the registry not found, refused credentials,
189
+ * the daemon unreachable, or the component destroyed during the pull (its message then says it was aborted).
190
+ */
191
+ pullImage(options: ImagePullOptions): Promise<DockerImage>;
192
+ /**
193
+ * Build an image with BuildKit, as `docker build`, and wait for its end. The build context is made of the `files`
194
+ * of the `workdir` (relative paths; a directory with its content), without the ones its `.dockerignore` excludes,
195
+ * and always with the Dockerfile. The progress is given to the output callback as the lines of
196
+ * `docker build --progress=plain` (`{id: 'moby.buildkit.trace', stream: '#2 [1/2] FROM alpine'}`).
197
+ *
198
+ * With `auth`, the base images of the Dockerfile (its `FROM` lines) are pulled first with these credentials, as
199
+ * BuildKit is not given them.
200
+ * @param options The context (`workdir`, `files`), the Dockerfile, the name of the image (`repoTag`; a generated
201
+ * `unnamed_img_…` name by default), the platform, the target stage, the build arguments, the registry credentials
202
+ * and the output callback.
203
+ * @returns The image built.
204
+ * @throws {DockerImageBuildException} When the build fails: a step failing, the Dockerfile or a file of the context
205
+ * missing, a base image which cannot be pulled, the daemon unreachable, or the component destroyed during the build
206
+ * (its message then says it was aborted).
207
+ */
208
+ buildImage(options: ImageBuildOptions): Promise<DockerImage>;
209
+ /**
210
+ * Load an image from a tar archive written by `docker save` (or {@link DockerImage.export}), as `docker load`. The
211
+ * tags saved in the archive are restored.
212
+ * @param options The archive (`source`, a file path or a readable stream) and `quiet` (`false` by default).
213
+ * @returns The image loaded.
214
+ * @throws {DockerImageImportException} When the daemon rejects the archive, or when the loaded image is unknown.
215
+ * @throws {Error} The error of the source when it cannot be read (`ENOENT` for a missing file), or the network
216
+ * error when the archive cannot be sent.
217
+ * @throws {DockerRequestException} When the daemon refuses the request.
218
+ */
219
+ importImage(options: ImageImportOptions): Promise<DockerImage>;
220
+ /**
221
+ * Get an image by its ID or its name, resolved by the daemon as `docker image inspect` does: the full ID
222
+ * (`sha256:…`), a unique prefix of it (`d9e853e8`), a tag (`alpine:3.20`), a name without its tag for `:latest`
223
+ * (`alpine`), a name with its registry (`docker.io/library/alpine:3.20`) or a digest (`alpine@sha256:…`).
224
+ * @param repoTagOrId The ID, the short ID, the name or the digest of the image.
225
+ * @returns The image.
226
+ * @throws {DockerImageNotFoundException} When the daemon finds no image with this ID or name.
227
+ */
228
+ getImage(repoTagOrId: string): Promise<DockerImage>;
229
+ /** Docker Container Operations **/
230
+ /**
231
+ * List the daemon's containers, the stopped ones included (as `docker ps -a`). Each container is inspected, with its
232
+ * image (see {@link Docker.getContainer}); a container removed during the listing is not listed.
233
+ * @returns The containers; an empty list when the component is destroyed during the call.
234
+ */
235
+ listContainers(): Promise<DockerContainer[]>;
236
+ /**
237
+ * Get a container by its ID, short ID or name, inspected with its image (`image` is `undefined` when its image no
238
+ * longer exists, removed with force). The object is a snapshot: its properties are refreshed by its own operations
239
+ * (`start()`, `stop()`…), not by the changes made by others.
240
+ * @param id The ID, a unique prefix of it, or the name of the container.
241
+ * @returns The container.
242
+ * @throws {DockerContainerNotFoundException} When the daemon has no such container.
243
+ */
244
+ getContainer(id: string): Promise<DockerContainer>;
245
+ /**
246
+ * Create a container from an image, as `docker create`: it is not started (see {@link DockerContainer.start}, or
247
+ * {@link DockerImage.run} to create and start it).
248
+ * @param imageId The ID or the name (`alpine:3.20`) of a local image: it is not pulled.
249
+ * @param options The container's settings: name, command, environment, ports, binds, devices, networks, limits…
250
+ * @returns The container created.
251
+ * @throws {DockerImageNotFoundException} When the image is not found.
252
+ * @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
253
+ * @throws {DockerRequestException} When the daemon refuses the settings: the name already used (HTTP 409), an
254
+ * invalid setting (HTTP 400).
255
+ * @throws {InvalidMethodAcceptException} When the settings are invalid.
256
+ */
257
+ createContainer(imageId: string, options: ContainerSettingOptions): Promise<DockerContainer>;
258
+ /**
259
+ * Create a container from an image for a platform, as `docker create --platform`: it is not started.
260
+ * @param imageId The ID or the name (`alpine:3.20`) of a local image: it is not pulled.
261
+ * @param platform The platform of the image used (`linux/arm64`), for an image having several.
262
+ * @param options The container's settings: name, command, environment, ports, binds, devices, networks, limits…
263
+ * @returns The container created.
264
+ * @throws {DockerImageNotFoundException} When the image is not found for the platform.
265
+ * @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
266
+ * @throws {DockerRequestException} When the daemon refuses the settings: the name already used (HTTP 409), an
267
+ * invalid setting (HTTP 400).
268
+ * @throws {InvalidMethodAcceptException} When the settings are invalid.
269
+ */
270
+ createContainer(imageId: string, platform: string, options: ContainerSettingOptions): Promise<DockerContainer>;
271
+ /** Docker Network Operations **/
272
+ /**
273
+ * Create a network, as `docker network create`.
274
+ * @param options The name, the driver (`'bridge'` by default, `'ipvlan'`, `'macvlan'`), its options, the subnets
275
+ * (`NetworkIPAMConfigs`; chosen by the daemon when empty or absent), `internal` and `enableIPv6`.
276
+ * @returns The network created.
277
+ * @throws {DockerRequestException} When the daemon refuses the network: the name already used (HTTP 409), a subnet
278
+ * overlapping another network's (HTTP 400).
279
+ */
280
+ createNetwork(options: NetworkCreateOptions): Promise<NetworkInfo>;
281
+ /**
282
+ * Remove a network, as `docker network rm`.
283
+ * @param id The ID, a unique prefix of it, or the name of the network.
284
+ * @throws {DockerNetworkNotFoundException} When the daemon has no such network.
285
+ * @throws {DockerRequestException} When the network has containers connected (HTTP 409), or is reserved (`bridge`,
286
+ * `host`, `none`: HTTP 403).
287
+ */
288
+ removeNetwork(id: string): Promise<void>;
289
+ /**
290
+ * List the daemon's networks, the reserved ones (`bridge`, `host`, `none`) included.
291
+ * @returns The networks; an empty list when the component is destroyed during the call.
292
+ */
293
+ listNetworks(): Promise<NetworkInfo[]>;
294
+ /**
295
+ * Get a network by its ID, a unique prefix of it, or its name, as `docker network inspect`.
296
+ * @param id The ID, a unique prefix of it, or the name of the network.
297
+ * @returns The network.
298
+ * @throws {DockerNetworkNotFoundException} When the daemon has no such network.
299
+ */
300
+ getNetwork(id: string): Promise<NetworkInfo>;
301
+ }