diff options
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/README.markdown')
-rw-r--r-- | vendor/github.com/fsouza/go-dockerclient/README.markdown | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/README.markdown b/vendor/github.com/fsouza/go-dockerclient/README.markdown new file mode 100644 index 0000000..234b9e4 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/README.markdown | |||
@@ -0,0 +1,106 @@ | |||
1 | # go-dockerclient | ||
2 | |||
3 | [![Travis](https://img.shields.io/travis/fsouza/go-dockerclient/master.svg?style=flat-square)](https://travis-ci.org/fsouza/go-dockerclient) | ||
4 | [![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/fsouza/go-dockerclient) | ||
5 | |||
6 | This package presents a client for the Docker remote API. It also provides | ||
7 | support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/). | ||
8 | It currently supports the Docker API up to version 1.23. | ||
9 | |||
10 | This package also provides support for docker's network API, which is a simple | ||
11 | passthrough to the libnetwork remote API. Note that docker's network API is | ||
12 | only available in docker 1.8 and above, and only enabled in docker if | ||
13 | DOCKER_EXPERIMENTAL is defined during the docker build process. | ||
14 | |||
15 | For more details, check the [remote API documentation](http://docs.docker.com/engine/reference/api/docker_remote_api/). | ||
16 | |||
17 | ## Vendoring | ||
18 | |||
19 | If you are having issues with Go 1.5 and have `GO15VENDOREXPERIMENT` set with an application that has go-dockerclient vendored, | ||
20 | please update your vendoring of go-dockerclient :) We recently moved the `vendor` directory to `external` so that go-dockerclient | ||
21 | is compatible with this configuration. See [338](https://github.com/fsouza/go-dockerclient/issues/338) and [339](https://github.com/fsouza/go-dockerclient/pull/339) | ||
22 | for details. | ||
23 | |||
24 | ## Example | ||
25 | |||
26 | ```go | ||
27 | package main | ||
28 | |||
29 | import ( | ||
30 | "fmt" | ||
31 | |||
32 | "github.com/fsouza/go-dockerclient" | ||
33 | ) | ||
34 | |||
35 | func main() { | ||
36 | endpoint := "unix:///var/run/docker.sock" | ||
37 | client, _ := docker.NewClient(endpoint) | ||
38 | imgs, _ := client.ListImages(docker.ListImagesOptions{All: false}) | ||
39 | for _, img := range imgs { | ||
40 | fmt.Println("ID: ", img.ID) | ||
41 | fmt.Println("RepoTags: ", img.RepoTags) | ||
42 | fmt.Println("Created: ", img.Created) | ||
43 | fmt.Println("Size: ", img.Size) | ||
44 | fmt.Println("VirtualSize: ", img.VirtualSize) | ||
45 | fmt.Println("ParentId: ", img.ParentID) | ||
46 | } | ||
47 | } | ||
48 | ``` | ||
49 | |||
50 | ## Using with TLS | ||
51 | |||
52 | In order to instantiate the client for a TLS-enabled daemon, you should use NewTLSClient, passing the endpoint and path for key and certificates as parameters. | ||
53 | |||
54 | ```go | ||
55 | package main | ||
56 | |||
57 | import ( | ||
58 | "fmt" | ||
59 | |||
60 | "github.com/fsouza/go-dockerclient" | ||
61 | ) | ||
62 | |||
63 | func main() { | ||
64 | endpoint := "tcp://[ip]:[port]" | ||
65 | path := os.Getenv("DOCKER_CERT_PATH") | ||
66 | ca := fmt.Sprintf("%s/ca.pem", path) | ||
67 | cert := fmt.Sprintf("%s/cert.pem", path) | ||
68 | key := fmt.Sprintf("%s/key.pem", path) | ||
69 | client, _ := docker.NewTLSClient(endpoint, cert, key, ca) | ||
70 | // use client | ||
71 | } | ||
72 | ``` | ||
73 | |||
74 | If using [docker-machine](https://docs.docker.com/machine/), or another application that exports environment variables | ||
75 | `DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH`, you can use NewClientFromEnv. | ||
76 | |||
77 | |||
78 | ```go | ||
79 | package main | ||
80 | |||
81 | import ( | ||
82 | "fmt" | ||
83 | |||
84 | "github.com/fsouza/go-dockerclient" | ||
85 | ) | ||
86 | |||
87 | func main() { | ||
88 | client, _ := docker.NewClientFromEnv() | ||
89 | // use client | ||
90 | } | ||
91 | ``` | ||
92 | |||
93 | See the documentation for more details. | ||
94 | |||
95 | ## Developing | ||
96 | |||
97 | All development commands can be seen in the [Makefile](Makefile). | ||
98 | |||
99 | Commited code must pass: | ||
100 | |||
101 | * [golint](https://github.com/golang/lint) | ||
102 | * [go vet](https://godoc.org/golang.org/x/tools/cmd/vet) | ||
103 | * [gofmt](https://golang.org/cmd/gofmt) | ||
104 | * [go test](https://golang.org/cmd/go/#hdr-Test_packages) | ||
105 | |||
106 | Running `make test` will check all of these. If your editor does not automatically call gofmt, `make fmt` will format all go files in this repository. | ||