@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,315 @@
1
+ import { Provider } from '@lakutata/core';
2
+ import type { DockerClient } from '../../client/DockerClient.js';
3
+ import { Time } from '@lakutata/utils/Time';
4
+ import { ContainerState } from '../types/ContainerState.js';
5
+ import { type Docker } from '../Docker.js';
6
+ import { type DockerImage } from './DockerImage.js';
7
+ import { ContainerNetwork } from '../types/ContainerNetwork.js';
8
+ import { ContainerPort } from '../types/ContainerPort.js';
9
+ import { ContainerBind } from '../types/ContainerBind.js';
10
+ import { ContainerDevice } from '../types/ContainerDevice.js';
11
+ import { ContainerStopOptions } from '../options/container/ContainerStopOptions.js';
12
+ import { ContainerRemoveOptions } from '../options/container/ContainerRemoveOptions.js';
13
+ import { ContainerSettingOptions } from '../options/container/ContainerSettingOptions.js';
14
+ import { ContainerRestartPolicy } from '../types/ContainerRestartPolicy.js';
15
+ import { type ContainerExecResult } from '../types/ContainerExecResult.js';
16
+ import { ContainerKillOptions } from '../options/container/ContainerKillOptions.js';
17
+ import { ContainerCommitOptions } from '../options/container/ContainerCommitOptions.js';
18
+ import { ContainerCapability } from '../types/ContainerCapability.js';
19
+ import { DockerContainerTTY } from './DockerContainerTTY.js';
20
+ import { ContainerCreateTTYOptions } from '../options/container/ContainerCreateTTYOptions.js';
21
+ import { ContainerLogsOptions } from '../options/container/ContainerLogsOptions.js';
22
+ import { ContainerStats } from '../types/ContainerStats.js';
23
+ import { ContainerExecOptions } from '../options/container/ContainerExecOptions.js';
24
+ import { ContainerExportDirectoryOptions } from '../options/container/ContainerExportDirectoryOptions.js';
25
+ /**
26
+ * A container of the Docker daemon, with its settings and its state as inspected, and its operations: start, stop,
27
+ * restart, pause, kill, remove, update, commit, exec, TTYs, logs, stats and the export of its files. It is not created
28
+ * with `new`: {@link Docker.getContainer}, {@link Docker.listContainers}, {@link Docker.createContainer} and
29
+ * {@link DockerImage.run} return it.
30
+ *
31
+ * Its properties are a snapshot, taken when it is obtained and refreshed by its own operations (`start()`, `stop()`,
32
+ * `restart()`, `pause()`, `unpause()`, `kill()`, `update()`): the changes made by others (the container exiting,
33
+ * `docker stop`) are seen by getting it again. Its operations reject with {@link DockerContainerNotFoundException} when
34
+ * the container was removed, with {@link DockerRequestException} when the daemon refuses them otherwise (not running:
35
+ * HTTP 409), and with the network error of Node.js when the daemon cannot be reached.
36
+ * @example
37
+ * ```typescript
38
+ * import {type Docker, type DockerContainer, type DockerImage} from 'lakutata/com/docker'
39
+ *
40
+ * declare const docker: Docker
41
+ *
42
+ * const image: DockerImage = await docker.getImage('alpine:3.20')
43
+ * const container: DockerContainer = await docker.createContainer(image.id, {
44
+ * name: 'worker',
45
+ * cmd: ['sh', '-c', 'echo started; sleep 3600'],
46
+ * env: {MODE: 'production'},
47
+ * ports: [{port: 8080, type: 'tcp', hostPorts: [18080]}],
48
+ * binds: [{hostPath: '/srv/data', containerPath: '/data', rw: true}],
49
+ * restartPolicy: 'unless-stopped'
50
+ * })
51
+ * await container.start()
52
+ * console.log(container.state.status, container.ports)
53
+ * //The exit code, stdout and stderr
54
+ * const {exitCode, stdout} = await container.exec({cmd: ['ls', '/data']})
55
+ * console.log(exitCode, stdout)
56
+ * await container.stop({timeout: 10})
57
+ * await container.remove()
58
+ * ```
59
+ */
60
+ export declare class DockerContainer extends Provider {
61
+ #private;
62
+ /**
63
+ * Give the client of the Engine API: set by the {@link Docker} component creating the object.
64
+ */
65
+ protected readonly getClient: () => DockerClient;
66
+ /**
67
+ * Give the {@link Docker} component which created the object.
68
+ */
69
+ protected readonly getDocker: () => Docker;
70
+ /**
71
+ * The full ID of the container (64 hexadecimal characters). It changes when {@link DockerContainer.update}
72
+ * recreates the container.
73
+ */
74
+ id: string;
75
+ /**
76
+ * The name of the container, without the leading `/` of the Engine API.
77
+ */
78
+ name: string;
79
+ /**
80
+ * The host name of the container (its short ID unless set when it was created).
81
+ */
82
+ hostname: string;
83
+ /**
84
+ * The image the container was created from; `undefined` when it no longer exists (removed with force while the
85
+ * container was stopped).
86
+ */
87
+ image: DockerImage | undefined;
88
+ /**
89
+ * How many times the daemon restarted the container, by its restart policy.
90
+ */
91
+ restartCount: number;
92
+ /**
93
+ * Whether the container has full access to the host (`--privileged`).
94
+ */
95
+ privileged: boolean;
96
+ /**
97
+ * Whether the container's main process has a TTY: its logs are then raw, not split into stdout and stderr.
98
+ */
99
+ tty: boolean;
100
+ /**
101
+ * The environment variables of the container, the image's included, by name.
102
+ */
103
+ env: Record<string, string>;
104
+ /**
105
+ * The memory limit of the container, in bytes; `0` for no limit.
106
+ */
107
+ memoryLimit: number;
108
+ /**
109
+ * The indexes of the CPUs the container may run on, sorted; empty for all of them.
110
+ */
111
+ cpuSet: number[];
112
+ /**
113
+ * When the daemon restarts the container after it exits (`'no'` by default; `'on-failure:3'` for 3 retries at
114
+ * most).
115
+ */
116
+ restartPolicy: ContainerRestartPolicy;
117
+ /**
118
+ * Whether the OOM killer is disabled for the container.
119
+ */
120
+ OOMKillDisable: boolean;
121
+ /**
122
+ * The kernel capabilities added to the container (`--cap-add`).
123
+ */
124
+ capabilities: ContainerCapability[];
125
+ /**
126
+ * The state of the container: its status (`'created'`, `'running'`, `'exited'`…), its process ID, its exit code
127
+ * and its start and finish times.
128
+ */
129
+ state: ContainerState;
130
+ /**
131
+ * The ports of the container, exposed by its image or published: one entry per IP address of the container, port
132
+ * and protocol, with the ports of the host published to it, each one once (empty when not published).
133
+ */
134
+ ports: ContainerPort[];
135
+ /**
136
+ * The directories and files of the host mounted in the container (the bind mounts; not the volumes).
137
+ */
138
+ binds: ContainerBind[];
139
+ /**
140
+ * The devices of the host added to the container.
141
+ */
142
+ devices: ContainerDevice[];
143
+ /**
144
+ * The networks the container is connected to, with its addresses in each.
145
+ */
146
+ networks: ContainerNetwork[];
147
+ /**
148
+ * The cgroup the container joins (`container:<name|id>`), as the daemon reports it (an empty string by default).
149
+ */
150
+ cgroup: string | undefined;
151
+ /**
152
+ * The parent cgroup under which the container's cgroup is created (an empty string by default).
153
+ */
154
+ cgroupParent: string | undefined;
155
+ /**
156
+ * The PID namespace mode of the container: `'host'`, `'container:<name|id>'`, or an empty string for its own.
157
+ */
158
+ pidMode: string | undefined;
159
+ /**
160
+ * When the container was created.
161
+ */
162
+ createdAt: Time;
163
+ /**
164
+ * Inspect the container.
165
+ * @throws {DockerContainerNotFoundException} When the container does not exist.
166
+ * @protected
167
+ */
168
+ protected init(): Promise<void>;
169
+ /**
170
+ * Abort the requests in progress of the object (the container itself is left as it is).
171
+ * @protected
172
+ */
173
+ protected destroy(): Promise<void>;
174
+ /**
175
+ * Refresh the properties from the daemon's inspection of the container, and its image (`undefined` when it no longer
176
+ * exists).
177
+ * @throws {DockerContainerNotFoundException} When the container does not exist.
178
+ * @protected
179
+ */
180
+ protected syncContainerInfo(): Promise<void>;
181
+ /**
182
+ * Start the container, as `docker start`, then refresh its properties. A container already running is left as it is
183
+ * (as the Docker CLI does).
184
+ * @throws {DockerContainerNotFoundException} When the container was removed.
185
+ * @throws {DockerRequestException} When it fails to start (HTTP 500: a command not found, a port already used).
186
+ */
187
+ start(): Promise<void>;
188
+ /**
189
+ * Stop the container, as `docker stop`: send its stop signal, wait for it to exit, kill it after the timeout; then
190
+ * refresh its properties.
191
+ * @param options The signal sent (the container's stop signal, `SIGTERM` by default) and the timeout before the kill,
192
+ * in seconds (the container's, 10 by default). A container already stopped is left as it is (as the Docker CLI does).
193
+ * @throws {DockerContainerNotFoundException} When the container was removed.
194
+ */
195
+ stop(options?: ContainerStopOptions): Promise<void>;
196
+ /**
197
+ * Suspend the processes of the container, as `docker pause`, then refresh its properties.
198
+ * @throws {DockerContainerNotFoundException} When the container was removed.
199
+ * @throws {DockerRequestException} When it is not running or already paused (HTTP 409).
200
+ */
201
+ pause(): Promise<void>;
202
+ /**
203
+ * Resume the processes of a paused container, as `docker unpause`, then refresh its properties.
204
+ * @throws {DockerContainerNotFoundException} When the container was removed.
205
+ * @throws {DockerRequestException} When it is not paused (HTTP 409).
206
+ */
207
+ unpause(): Promise<void>;
208
+ /**
209
+ * Restart the container, as `docker restart`: stop it as {@link DockerContainer.stop} does (when it runs), then start
210
+ * it; then refresh its properties.
211
+ * @param options The signal sent (the container's stop signal, `SIGTERM` by default) and the timeout before the kill,
212
+ * in seconds (the container's, 10 by default).
213
+ * @throws {DockerContainerNotFoundException} When the container was removed.
214
+ * @throws {DockerRequestException} When it fails to start (HTTP 500).
215
+ */
216
+ restart(options?: ContainerStopOptions): Promise<void>;
217
+ /**
218
+ * Remove the container, as `docker rm -v`: its anonymous volumes are removed with it. The object is not refreshed:
219
+ * its other operations then fail with {@link DockerContainerNotFoundException}.
220
+ * @param options `force` kills a running container first (`false` by default).
221
+ * @throws {DockerContainerNotFoundException} When the container was already removed.
222
+ * @throws {DockerRequestException} When it is running and `force` is not set (HTTP 409).
223
+ */
224
+ remove(options?: ContainerRemoveOptions): Promise<void>;
225
+ /**
226
+ * Change the settings of the container, keeping the others. The memory limit, the CPUs and the restart policy are
227
+ * changed live, as `docker update` does, and the name by renaming it, the container running on. The other
228
+ * settings (and removing the memory limit or the CPU set, which Docker cannot do live) recreate the container: a new
229
+ * one is created from the old one's whole configuration (its image, command, entrypoint, environment, mounts,
230
+ * networks and their static addresses, the addresses Docker assigned being assigned again), with the settings
231
+ * changed, under a temporary name. Once created (and, when the old one was running, the old one stopped and the new
232
+ * one started), the old one is removed without its volumes and the new one takes its name (and its anonymous
233
+ * volumes, mounted again). The object follows the new container: its `id` changes.
234
+ * @remarks The old container is kept when the creation or the start of the new one fails (invalid settings, the
235
+ * image removed, a network missing): the new one is removed, the old one started again when it was running, and the
236
+ * call rejects. Its files outside the volumes are not kept by a recreation (commit them first, see
237
+ * {@link DockerContainer.commit}). A container removed by Docker when it stops (`AutoRemove`) cannot be kept.
238
+ * @param options The settings changed: `memoryLimit`, `cpuSet` and `restartPolicy` live (the swap limit set to
239
+ * Docker's default with the memory), `name` by a renaming; `hostname`, `env` (replacing the container's variables;
240
+ * the image's are added again), `cmd`, `entrypoint`, `tty`, `privileged`, `ports`, `binds` (replacing the bind
241
+ * mounts, the volumes kept), `devices`, `networks` (replacing the networks), `capabilities`, `OOMKillDisable`,
242
+ * `cgroup`, `cgroupParent` and `pidMode` by a recreation. The settings absent are kept.
243
+ * @throws {InvalidMethodAcceptException} When the settings are invalid.
244
+ * @throws {DockerContainerNotFoundException} When the container was removed.
245
+ * @throws {DockerImageNotFoundException} When the container must be recreated and its image no longer exists.
246
+ * @throws {DockerNetworkNotFoundException} When a network of the settings is not found.
247
+ * @throws {DockerRequestException} When the daemon refuses the changes: a limit refused (HTTP 400), the name
248
+ * already used (HTTP 409), the new container failing to start (HTTP 500).
249
+ */
250
+ update(options: ContainerSettingOptions): Promise<void>;
251
+ /**
252
+ * Create an image from the container's current files, as `docker commit`.
253
+ * @param options The name of the image (`repoTag`, `repo:tag`; none by default) and whether the container is paused
254
+ * while it is committed (`pauseBeforeCommitting`, `true` by default).
255
+ * @returns The image created.
256
+ * @throws {DockerContainerNotFoundException} When the container was removed.
257
+ */
258
+ commit(options?: ContainerCommitOptions): Promise<DockerImage>;
259
+ /**
260
+ * Start an interactive command with a TTY in the running container, as `docker exec -it`. The command runs until it
261
+ * exits (or its stream is closed): see {@link DockerContainerTTY}.
262
+ * @param options The command (`['/bin/sh']` by default; the program and its arguments, run as they are, or a command
263
+ * line, run by `/bin/sh -c`) and the initial console size.
264
+ * @returns The TTY, its command started.
265
+ * @throws {DockerContainerNotFoundException} When the container was removed.
266
+ * @throws {DockerRequestException} When the container is not running (HTTP 409).
267
+ */
268
+ createTTY(options?: ContainerCreateTTYOptions): Promise<DockerContainerTTY>;
269
+ /**
270
+ * Read the logs of the container's main process, as `docker logs`: stdout and stderr in one stream, in their order
271
+ * (split from Docker's multiplexed format unless the container has a TTY).
272
+ * @remarks The logs are followed by default: the stream does not end while the container runs. Pass `follow: false`
273
+ * for the logs written so far.
274
+ * @param options `follow` (`true` by default), `since` and `until` (UNIX timestamps in seconds; `0`, no bound, by
275
+ * default), `timestamps` (`false` by default) and `tail` (a number of lines from the end; all by default).
276
+ * @returns The readable stream of the logs.
277
+ * @throws {DockerContainerNotFoundException} When the container was removed.
278
+ */
279
+ logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
280
+ /**
281
+ * Read the resource usage of the container once, as `docker stats --no-stream`: CPU, memory, network, block I/O and
282
+ * processes, as the Engine API reports them.
283
+ * @returns The statistics.
284
+ * @throws {DockerContainerNotFoundException} When the container was removed.
285
+ */
286
+ stats(): Promise<ContainerStats>;
287
+ /**
288
+ * Run a command in the running container, as `docker exec` (no TTY, no stdin), and wait for it to exit. As the
289
+ * containerd component's, a command exiting with a non-zero code resolves too: check its `exitCode`.
290
+ * @param options The command: a program and its arguments (`['ls', '-l']`), run as they are, or a command line
291
+ * (`'ls /data | wc -l'`), run by `/bin/sh -c`.
292
+ * @returns The exit code of the command, its stdout and its stderr (a program not found: exit code `127` or `126`,
293
+ * the error in the output).
294
+ * @throws {DockerContainerNotFoundException} When the container was removed.
295
+ * @throws {DockerRequestException} When the container is not running or paused (HTTP 409).
296
+ */
297
+ exec(options: ContainerExecOptions): Promise<ContainerExecResult>;
298
+ /**
299
+ * Send a signal to the container's main process, as `docker kill` (`SIGKILL` by default), then refresh its properties.
300
+ * @param options The signal sent: a name (`'SIGHUP'`) or a number (`1`); `SIGKILL` by default.
301
+ * @throws {DockerContainerNotFoundException} When the container was removed.
302
+ * @throws {DockerRequestException} When the container is not running (HTTP 409), or the signal is unknown.
303
+ */
304
+ kill(options?: ContainerKillOptions): Promise<void>;
305
+ /**
306
+ * Copy a file or a directory out of the container as a tar archive, as `docker cp container:path -`. The container
307
+ * may be stopped.
308
+ * @param options The path in the container, and the `destination` of the archive: a file path (created or
309
+ * overwritten) or a writable stream (ended after the archive).
310
+ * @throws {DockerContainerNotFoundException} When the container was removed.
311
+ * @throws {DockerRequestException} When the path is not found in the container (HTTP 404).
312
+ * @throws {Error} The error of the destination.
313
+ */
314
+ exportDirectory(options: ContainerExportDirectoryOptions): Promise<void>;
315
+ }