|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| internal/ | H | 02-Oct-2018 | - | 1,254 | 834 |
| testing/ | H | 02-Oct-2018 | - | 6,730 | 6,304 |
| travis-scripts/ | H | 02-Oct-2018 | - | 35 | 18 |
| .gitignore | H A D | 02-Oct-2018 | 72 | 5 | 4 |
| .travis.yml | H A D | 02-Oct-2018 | 707 | 31 | 30 |
| AUTHORS | H A D | 02-Oct-2018 | 2.8 KiB | 200 | 198 |
| DOCKER-LICENSE | H A D | 02-Oct-2018 | 276 | 7 | 5 |
| Gopkg.toml | H A D | 02-Oct-2018 | 631 | 29 | 22 |
| LICENSE | H A D | 02-Oct-2018 | 1.3 KiB | 24 | 19 |
| Makefile | H A D | 02-Oct-2018 | 636 | 35 | 25 |
| README.markdown | H A D | 02-Oct-2018 | 3.8 KiB | 134 | 99 |
| appveyor.yml | H A D | 02-Oct-2018 | 652 | 22 | 21 |
| auth.go | H A D | 02-Oct-2018 | 6.7 KiB | 237 | 170 |
| auth_test.go | H A D | 02-Oct-2018 | 8.6 KiB | 236 | 216 |
| build_test.go | H A D | 02-Oct-2018 | 4 KiB | 167 | 145 |
| change.go | H A D | 02-Oct-2018 | 944 | 44 | 24 |
| change_test.go | H A D | 02-Oct-2018 | 697 | 26 | 19 |
| client.go | H A D | 02-Oct-2018 | 29.6 KiB | 1,094 | 910 |
| client_stress_test.go | H A D | 02-Oct-2018 | 3.6 KiB | 136 | 127 |
| client_test.go | H A D | 02-Oct-2018 | 28.1 KiB | 846 | 792 |
| client_unix.go | H A D | 02-Oct-2018 | 810 | 33 | 20 |
| client_unix_test.go | H A D | 02-Oct-2018 | 1.6 KiB | 70 | 60 |
| client_windows.go | H A D | 02-Oct-2018 | 1.1 KiB | 46 | 32 |
| client_windows_test.go | H A D | 02-Oct-2018 | 1.1 KiB | 45 | 30 |
| container.go | H A D | 02-Oct-2018 | 74.3 KiB | 1,625 | 1,142 |
| container_test.go | H A D | 02-Oct-2018 | 90.4 KiB | 2,808 | 2,657 |
| container_unix_test.go | H A D | 02-Oct-2018 | 2.8 KiB | 109 | 100 |
| distribution.go | H A D | 02-Oct-2018 | 792 | 27 | 18 |
| distribution_test.go | H A D | 02-Oct-2018 | 1.2 KiB | 55 | 49 |
| env.go | H A D | 02-Oct-2018 | 4.5 KiB | 173 | 115 |
| env_test.go | H A D | 02-Oct-2018 | 9.1 KiB | 372 | 345 |
| event.go | H A D | 02-Oct-2018 | 10.7 KiB | 411 | 330 |
| event_test.go | H A D | 02-Oct-2018 | 8 KiB | 304 | 257 |
| example_test.go | H A D | 02-Oct-2018 | 2.7 KiB | 139 | 117 |
| exec.go | H A D | 02-Oct-2018 | 8.3 KiB | 218 | 147 |
| exec_test.go | H A D | 02-Oct-2018 | 9.2 KiB | 309 | 294 |
| go.mod | H A D | 02-Oct-2018 | 2 KiB | 43 | 41 |
| go.sum | H A D | 02-Oct-2018 | 7.1 KiB | 79 | 78 |
| image.go | H A D | 02-Oct-2018 | 23.3 KiB | 714 | 511 |
| image_test.go | H A D | 02-Oct-2018 | 33.8 KiB | 1,175 | 1,112 |
| integration_test.go | H A D | 02-Oct-2018 | 2.2 KiB | 95 | 82 |
| misc.go | H A D | 02-Oct-2018 | 5.1 KiB | 189 | 132 |
| misc_test.go | H A D | 02-Oct-2018 | 5.1 KiB | 209 | 196 |
| network.go | H A D | 02-Oct-2018 | 10.3 KiB | 325 | 220 |
| network_test.go | H A D | 02-Oct-2018 | 8.4 KiB | 279 | 259 |
| plugin.go | H A D | 02-Oct-2018 | 13.5 KiB | 419 | 277 |
| plugins_test.go | H A D | 02-Oct-2018 | 8 KiB | 319 | 295 |
| registry_auth.go | H A D | 02-Oct-2018 | 253 | 11 | 5 |
| signal.go | H A D | 02-Oct-2018 | 1.3 KiB | 50 | 39 |
| swarm.go | H A D | 02-Oct-2018 | 4.5 KiB | 157 | 117 |
| swarm_configs.go | H A D | 02-Oct-2018 | 4.4 KiB | 172 | 123 |
| swarm_configs_test.go | H A D | 02-Oct-2018 | 7.9 KiB | 252 | 232 |
| swarm_node.go | H A D | 02-Oct-2018 | 3.2 KiB | 131 | 93 |
| swarm_node_test.go | H A D | 02-Oct-2018 | 6.8 KiB | 262 | 245 |
| swarm_secrets.go | H A D | 02-Oct-2018 | 4.4 KiB | 172 | 123 |
| swarm_secrets_test.go | H A D | 02-Oct-2018 | 8.6 KiB | 286 | 266 |
| swarm_service.go | H A D | 02-Oct-2018 | 5.8 KiB | 214 | 153 |
| swarm_service_test.go | H A D | 02-Oct-2018 | 17.4 KiB | 616 | 582 |
| swarm_task.go | H A D | 02-Oct-2018 | 1.7 KiB | 71 | 49 |
| swarm_task_test.go | H A D | 02-Oct-2018 | 8.8 KiB | 377 | 364 |
| swarm_test.go | H A D | 02-Oct-2018 | 7 KiB | 211 | 194 |
| system.go | H A D | 02-Oct-2018 | 2.1 KiB | 73 | 43 |
| system_test.go | H A D | 02-Oct-2018 | 2.8 KiB | 109 | 101 |
| tar.go | H A D | 02-Oct-2018 | 3.4 KiB | 123 | 89 |
| tls.go | H A D | 02-Oct-2018 | 3 KiB | 119 | 84 |
| volume.go | H A D | 02-Oct-2018 | 5.3 KiB | 193 | 133 |
| volume_test.go | H A D | 02-Oct-2018 | 5.8 KiB | 208 | 192 |
README.markdown
1# go-dockerclient
2
3[![Travis Build Status](https://travis-ci.org/fsouza/go-dockerclient.svg?branch=master)](https://travis-ci.org/fsouza/go-dockerclient)
4[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4m374pti06ubg2l7?svg=true)](https://ci.appveyor.com/project/fsouza/go-dockerclient)
5[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/fsouza/go-dockerclient)
6
7This package presents a client for the Docker remote API. It also provides
8support for the extensions in the [Swarm API](https://docs.docker.com/swarm/swarm-api/).
9
10This package also provides support for docker's network API, which is a simple
11passthrough to the libnetwork remote API. Note that docker's network API is
12only available in docker 1.8 and above, and only enabled in docker if
13DOCKER_EXPERIMENTAL is defined during the docker build process.
14
15For more details, check the [remote API
16documentation](http://docs.docker.com/engine/reference/api/docker_remote_api/).
17
18## Example
19
20```go
21package main
22
23import (
24 "fmt"
25
26 "github.com/fsouza/go-dockerclient"
27)
28
29func main() {
30 endpoint := "unix:///var/run/docker.sock"
31 client, err := docker.NewClient(endpoint)
32 if err != nil {
33 panic(err)
34 }
35 imgs, err := client.ListImages(docker.ListImagesOptions{All: false})
36 if err != nil {
37 panic(err)
38 }
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
52In order to instantiate the client for a TLS-enabled daemon, you should use
53NewTLSClient, passing the endpoint and path for key and certificates as
54parameters.
55
56```go
57package main
58
59import (
60 "fmt"
61
62 "github.com/fsouza/go-dockerclient"
63)
64
65func main() {
66 endpoint := "tcp://[ip]:[port]"
67 path := os.Getenv("DOCKER_CERT_PATH")
68 ca := fmt.Sprintf("%s/ca.pem", path)
69 cert := fmt.Sprintf("%s/cert.pem", path)
70 key := fmt.Sprintf("%s/key.pem", path)
71 client, _ := docker.NewTLSClient(endpoint, cert, key, ca)
72 // use client
73}
74```
75
76If using [docker-machine](https://docs.docker.com/machine/), or another
77application that exports environment variables `DOCKER_HOST`,
78`DOCKER_TLS_VERIFY`, `DOCKER_CERT_PATH`, you can use NewClientFromEnv.
79
80
81```go
82package main
83
84import (
85 "fmt"
86
87 "github.com/fsouza/go-dockerclient"
88)
89
90func main() {
91 client, _ := docker.NewClientFromEnv()
92 // use client
93}
94```
95
96See the documentation for more details.
97
98## Developing
99
100All development commands can be seen in the [Makefile](Makefile).
101
102Commited code must pass:
103
104* [golint](https://github.com/golang/lint) (with some exceptions, see the Makefile).
105* [go vet](https://golang.org/cmd/vet/)
106* [gofmt](https://golang.org/cmd/gofmt)
107* [go test](https://golang.org/cmd/go/#hdr-Test_packages)
108
109Running `make test` will check all of these. If your editor does not
110automatically call ``gofmt -s``, `make fmt` will format all go files in this
111repository.
112
113## Vendoring
114
115go-dockerclient uses [dep](https://github.com/golang/dep/) for vendoring. If
116you're using dep, you should be able to pick go-dockerclient releases and get
117the proper dependencies.
118
119With other vendoring tools, users might need to specify go-dockerclient's
120dependencies manually.
121
122## Using with Docker 1.9 and Go 1.4
123
124There's a tag for using go-dockerclient with Docker 1.9 (which requires
125compiling go-dockerclient with Go 1.4), the tag name is ``docker-1.9/go-1.4``.
126
127The instructions below can be used to get a version of go-dockerclient that compiles with Go 1.4:
128
129```
130% git clone -b docker-1.9/go-1.4 https://github.com/fsouza/go-dockerclient.git $GOPATH/src/github.com/fsouza/go-dockerclient
131% git clone -b v1.9.1 https://github.com/docker/docker.git $GOPATH/src/github.com/docker/docker
132% go get github.com/fsouza/go-dockerclient
133```
134