Files
docker-cli/vendor/github.com/docker/docker/client
Andrew Hsu f6af8b3dfb vndr docker/docker to 53e55db
And update the associated packages that have also updated from
docker/docker vendor.conf.

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2018-09-06 00:44:39 +00:00
..
2018-08-02 13:10:06 +09:00
2018-09-06 00:44:39 +00:00
2018-08-02 13:10:06 +09:00
2018-07-04 01:14:40 +00:00
2018-08-20 15:32:25 -07:00
2017-05-08 10:33:56 -07:00
2018-08-02 13:10:06 +09:00

Go client for the Docker Engine API

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.

For example, to list running containers (the equivalent of docker ps):

package main

import (
	"context"
	"fmt"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/client"
)

func main() {
	cli, err := client.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)
	}
}

Full documentation is available on GoDoc.