client/README.md
520e601d
 # Go client for the Docker Engine API
a00106f9
 
070038bb
 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.
a00106f9
 
070038bb
 For example, to list running containers (the equivalent of `docker ps`):
a00106f9
 
 ```go
 package main
 
 import (
a98d9579
 	"context"
070038bb
 	"fmt"
a00106f9
 
 	"github.com/docker/docker/api/types"
070038bb
 	"github.com/docker/docker/client"
a00106f9
 )
 
 func main() {
070038bb
 	cli, err := client.NewEnvClient()
a00106f9
 	if err != nil {
 		panic(err)
 	}
 
070038bb
 	containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
a00106f9
 	if err != nil {
 		panic(err)
 	}
 
070038bb
 	for _, container := range containers {
 		fmt.Printf("%s %s\n", container.ID[:10], container.Image)
a00106f9
 	}
 }
 ```
070038bb
 
 [Full documentation is available on GoDoc.](https://godoc.org/github.com/docker/docker/client)