summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiaan van Stijn <thaJeztah@users.noreply.github.com>2016-09-12 22:56:32 +0200
committerGitHub <noreply@github.com>2016-09-12 22:56:32 +0200
commit6edf09cf5821aa947d9d52e21d72b065184fc421 (patch)
tree04c27a3f380d1787ac67e0d7c9b84badf757220e
parent23d5b3be9b244aa3a175498a2a464e560a824603 (diff)
parenta00106f9a5cf58cced011c93e98fbe1d7f65c4e7 (diff)
downloaddocker-6edf09cf5821aa947d9d52e21d72b065184fc421.tar.gz
Merge pull request #26488 from vdemeester/26450-add-client-package-readme
Add a README to the client's packageā€¦
-rw-r--r--client/README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/client/README.md b/client/README.md
new file mode 100644
index 0000000000..7872d94a53
--- /dev/null
+++ b/client/README.md
@@ -0,0 +1,37 @@
+## Client
+
+The client package implements a fully featured http client to interact with the Docker engine. It's modeled after the requirements of the Docker engine CLI, but it can also serve other purposes.
+
+### Usage
+
+You can use this client package in your applications by creating a new client object. Then use that object to execute operations against the remote server. Follow the example below to see how to list all the containers running in a Docker engine host:
+
+```go
+package main
+
+import (
+ "fmt"
+
+ "github.com/docker/docker/client"
+ "github.com/docker/docker/api/types"
+ "golang.org/x/net/context"
+)
+
+func main() {
+ defaultHeaders := map[string]string{"User-Agent": "engine-api-cli-1.0"}
+ cli, err := client.NewClient("unix:///var/run/docker.sock", "v1.22", nil, defaultHeaders)
+ if err != nil {
+ panic(err)
+ }
+
+ options := types.ContainerListOptions{All: true}
+ containers, err := cli.ContainerList(context.Background(), options)
+ if err != nil {
+ panic(err)
+ }
+
+ for _, c := range containers {
+ fmt.Println(c.ID)
+ }
+}
+```