Files
kubernetes/vendor/github.com/docker/docker/client
Davanum Srinivas 8e8e15357b update docker dependency
Tag:
https://github.com/moby/moby/tree/v19.03.8

SHA:
aa6a9891b09cce3d9004121294301a30d45d998d

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-03-31 10:21:28 -04:00
..
2020-03-31 10:21:28 -04:00
2020-03-31 10:21:28 -04:00
2019-04-03 10:19:40 -04:00
2020-03-31 10:21:28 -04:00
2019-04-03 10:19:40 -04:00
2019-04-03 10:19:40 -04:00
2019-04-03 10:19:40 -04:00
2020-03-31 10:21:28 -04:00
2020-03-31 10:21:28 -04:00
2020-03-31 10:21:28 -04:00
2019-04-03 10:19:40 -04:00
2020-03-31 10:21:28 -04:00
2019-04-03 10:19:40 -04:00
2019-04-03 10:19:40 -04:00
2019-04-03 10:19:40 -04:00
2019-04-03 10:19:40 -04: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.NewClientWithOpts(client.FromEnv)
	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.