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