Files
docker-cli/components/engine/client
Victor Vieux 36fa7495ed Merge pull request #28217 from Microsoft/jjh/373engineapifollowup
Tidy GetDockerOS() function
Upstream-commit: 4453fd22a7ff3f51383c814a4cbd119bccbe7a92
Component: engine
2016-11-10 18:57:56 -08:00
..
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-10-31 11:16:02 -04:00
2016-11-09 14:46:53 -08:00
2016-11-09 14:27:43 -05:00
2016-09-22 14:42:06 -04:00
2016-09-22 14:42:06 -04:00
2016-10-31 17:36:49 -04:00
2016-11-09 14:46:53 -08:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-11-10 15:51:32 -08:00
2016-09-07 11:05:58 -07:00
2016-10-25 06:43:54 +00:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-10-24 15:20:01 -07:00
2016-10-10 09:27:07 +01:00
2016-11-09 14:27:43 -05:00
2016-11-09 14:27:43 -05:00
2016-11-09 14:27:45 -05:00
2016-11-09 14:27:45 -05:00
2016-11-10 13:46:02 -08:00
2016-11-10 13:46:02 -08:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-09-07 11:05:58 -07:00
2016-11-09 16:09:01 -08:00
2016-09-07 11:05:58 -07:00
2016-11-09 14:46:53 -08:00
2016-09-07 11:05:58 -07:00

Go client for the Docker Remote 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.