forked from docker/go-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
42 lines (31 loc) · 927 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
Package docker is the official Go client for the Docker API.
For more information about the Docker API, see the documentation:
https://docs.docker.com/develop/sdk
Usage
You use the library by creating a client object and calling methods on it. The
client can be created either from environment variables with NewEnvClient, or
configured manually with NewClient.
For example, to list running containers (the equivalent of "docker ps"):
package main
import (
"context"
"fmt"
"docker.io/go-docker"
"docker.io/go-docker/api/types"
)
func main() {
cli, err := docker.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)
}
}
*/
package docker // import "docker.io/go-docker"