tree: 3804a16bcc1e637d549b6b69aa2a266c5db40401 [path history] [tgz]
  1. README.md
  2. checkpoint_create.go
  3. checkpoint_create_test.go
  4. checkpoint_delete.go
  5. checkpoint_delete_test.go
  6. checkpoint_list.go
  7. checkpoint_list_test.go
  8. client.go
  9. client_mock_test.go
  10. client_test.go
  11. client_unix.go
  12. client_windows.go
  13. config_create.go
  14. config_create_test.go
  15. config_inspect.go
  16. config_inspect_test.go
  17. config_list.go
  18. config_list_test.go
  19. config_remove.go
  20. config_remove_test.go
  21. config_update.go
  22. config_update_test.go
  23. container_attach.go
  24. container_commit.go
  25. container_commit_test.go
  26. container_copy.go
  27. container_copy_test.go
  28. container_create.go
  29. container_create_test.go
  30. container_diff.go
  31. container_diff_test.go
  32. container_exec.go
  33. container_exec_test.go
  34. container_export.go
  35. container_export_test.go
  36. container_inspect.go
  37. container_inspect_test.go
  38. container_kill.go
  39. container_kill_test.go
  40. container_list.go
  41. container_list_test.go
  42. container_logs.go
  43. container_logs_test.go
  44. container_pause.go
  45. container_pause_test.go
  46. container_prune.go
  47. container_prune_test.go
  48. container_remove.go
  49. container_remove_test.go
  50. container_rename.go
  51. container_rename_test.go
  52. container_resize.go
  53. container_resize_test.go
  54. container_restart.go
  55. container_restart_test.go
  56. container_start.go
  57. container_start_test.go
  58. container_stats.go
  59. container_stats_test.go
  60. container_stop.go
  61. container_stop_test.go
  62. container_top.go
  63. container_top_test.go
  64. container_unpause.go
  65. container_unpause_test.go
  66. container_update.go
  67. container_update_test.go
  68. container_wait.go
  69. container_wait_test.go
  70. disk_usage.go
  71. disk_usage_test.go
  72. distribution_inspect.go
  73. errors.go
  74. events.go
  75. events_test.go
  76. hijack.go
  77. image_build.go
  78. image_build_test.go
  79. image_create.go
  80. image_create_test.go
  81. image_history.go
  82. image_history_test.go
  83. image_import.go
  84. image_import_test.go
  85. image_inspect.go
  86. image_inspect_test.go
  87. image_list.go
  88. image_list_test.go
  89. image_load.go
  90. image_load_test.go
  91. image_prune.go
  92. image_prune_test.go
  93. image_pull.go
  94. image_pull_test.go
  95. image_push.go
  96. image_push_test.go
  97. image_remove.go
  98. image_remove_test.go
  99. image_save.go
  100. image_save_test.go
  101. image_search.go
  102. image_search_test.go
  103. image_tag.go
  104. image_tag_test.go
  105. info.go
  106. info_test.go
  107. interface.go
  108. interface_experimental.go
  109. interface_stable.go
  110. login.go
  111. network_connect.go
  112. network_connect_test.go
  113. network_create.go
  114. network_create_test.go
  115. network_disconnect.go
  116. network_disconnect_test.go
  117. network_inspect.go
  118. network_inspect_test.go
  119. network_list.go
  120. network_list_test.go
  121. network_prune.go
  122. network_prune_test.go
  123. network_remove.go
  124. network_remove_test.go
  125. node_inspect.go
  126. node_inspect_test.go
  127. node_list.go
  128. node_list_test.go
  129. node_remove.go
  130. node_remove_test.go
  131. node_update.go
  132. node_update_test.go
  133. parse_logs.go
  134. parse_logs_test.go
  135. ping.go
  136. ping_test.go
  137. plugin_create.go
  138. plugin_disable.go
  139. plugin_disable_test.go
  140. plugin_enable.go
  141. plugin_enable_test.go
  142. plugin_inspect.go
  143. plugin_inspect_test.go
  144. plugin_install.go
  145. plugin_list.go
  146. plugin_list_test.go
  147. plugin_push.go
  148. plugin_push_test.go
  149. plugin_remove.go
  150. plugin_remove_test.go
  151. plugin_set.go
  152. plugin_set_test.go
  153. plugin_upgrade.go
  154. request.go
  155. request_test.go
  156. secret_create.go
  157. secret_create_test.go
  158. secret_inspect.go
  159. secret_inspect_test.go
  160. secret_list.go
  161. secret_list_test.go
  162. secret_remove.go
  163. secret_remove_test.go
  164. secret_update.go
  165. secret_update_test.go
  166. service_create.go
  167. service_create_test.go
  168. service_inspect.go
  169. service_inspect_test.go
  170. service_list.go
  171. service_list_test.go
  172. service_logs.go
  173. service_logs_test.go
  174. service_remove.go
  175. service_remove_test.go
  176. service_update.go
  177. service_update_test.go
  178. swarm_get_unlock_key.go
  179. swarm_get_unlock_key_test.go
  180. swarm_init.go
  181. swarm_init_test.go
  182. swarm_inspect.go
  183. swarm_inspect_test.go
  184. swarm_join.go
  185. swarm_join_test.go
  186. swarm_leave.go
  187. swarm_leave_test.go
  188. swarm_unlock.go
  189. swarm_update.go
  190. swarm_update_test.go
  191. task_inspect.go
  192. task_inspect_test.go
  193. task_list.go
  194. task_list_test.go
  195. task_logs.go
  196. testdata/
  197. transport.go
  198. utils.go
  199. version.go
  200. volume_create.go
  201. volume_create_test.go
  202. volume_inspect.go
  203. volume_inspect_test.go
  204. volume_list.go
  205. volume_list_test.go
  206. volume_prune.go
  207. volume_remove.go
  208. volume_remove_test.go
client/README.md

Go client for the Docker Engine API

The docker command uses this package to communicate with the daemon. It can also be used by your own Go applications to do anything the command-line interface does – running containers, pulling images, managing swarms, etc.

For example, to list running containers (the equivalent of docker ps):

package main

import (
	"context"
	"fmt"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/client"
)

func main() {
	cli, err := client.NewEnvClient()
	if err != nil {
		panic(err)
	}

	containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
	if err != nil {
		panic(err)
	}

	for _, container := range containers {
		fmt.Printf("%s %s\n", container.ID[:10], container.Image)
	}
}

Full documentation is available on GoDoc.