Skip to content

Files

Latest commit

328de0b · Feb 25, 2021

History

History

client

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 7, 2016
Jan 3, 2019
Feb 16, 2021
Mar 18, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Oct 13, 2019
Feb 25, 2021
Jan 21, 2019
Feb 5, 2018
Feb 10, 2020
Jun 19, 2020
Feb 8, 2018
Feb 16, 2021
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Apr 23, 2018
Feb 16, 2021
Oct 13, 2019
Feb 16, 2021
Oct 17, 2019
Feb 16, 2021
Mar 20, 2020
Mar 18, 2019
Oct 13, 2019
Mar 18, 2019
Oct 17, 2019
Apr 23, 2018
Oct 13, 2019
Mar 18, 2019
Jan 6, 2020
Apr 23, 2018
Oct 13, 2019
Oct 17, 2019
Oct 13, 2019
May 20, 2018
Feb 10, 2020
Apr 23, 2018
Oct 13, 2019
Mar 18, 2019
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Apr 23, 2018
Oct 13, 2019
Apr 23, 2018
Oct 13, 2019
Feb 16, 2021
Oct 13, 2019
Apr 23, 2018
Oct 13, 2019
Feb 28, 2020
Oct 13, 2019
May 30, 2018
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Apr 23, 2018
Oct 13, 2019
Feb 16, 2021
Oct 13, 2019
Apr 23, 2018
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Feb 16, 2021
Feb 10, 2020
Apr 28, 2020
Oct 17, 2019
Oct 13, 2019
Oct 17, 2019
Feb 10, 2020
Feb 16, 2021
Oct 13, 2019
Feb 16, 2021
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Feb 16, 2021
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Oct 17, 2019
Oct 13, 2019
Apr 23, 2018
Oct 13, 2019
Mar 18, 2019
Feb 10, 2020
Mar 15, 2019
Oct 13, 2019
Dec 10, 2019
Dec 10, 2019
Mar 18, 2019
Feb 10, 2020
Apr 23, 2018
Oct 13, 2019
Feb 16, 2021
Oct 13, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Oct 13, 2019
May 21, 2020
Apr 23, 2018
Feb 5, 2018
Mar 18, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Feb 10, 2020
Oct 17, 2019
Oct 17, 2019
Mar 18, 2019
Feb 10, 2020
Mar 18, 2019
Oct 17, 2019
Mar 18, 2019
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Mar 18, 2019
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Apr 20, 2019
Feb 10, 2020
Jan 20, 2020
Feb 10, 2020
Mar 18, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Oct 13, 2019
Mar 15, 2019
Oct 17, 2019
Oct 13, 2019
Apr 23, 2018
Oct 17, 2019
Mar 18, 2019
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Aug 3, 2020
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Feb 16, 2021
Feb 10, 2020
Mar 18, 2019
Oct 13, 2019
Oct 14, 2019
Oct 13, 2019
May 20, 2018
Feb 10, 2020
Mar 18, 2019
Feb 10, 2020
Apr 16, 2020
Oct 17, 2019
Mar 18, 2019
Feb 10, 2020
Mar 18, 2019
Oct 17, 2019
Mar 18, 2019
Oct 13, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Apr 23, 2018
Oct 17, 2019
Feb 16, 2021
Oct 13, 2019
Mar 18, 2019
Oct 13, 2019
Apr 23, 2018
Feb 5, 2018
Feb 5, 2018
Mar 18, 2019
Mar 18, 2019
Oct 17, 2019
Mar 18, 2019
Feb 10, 2020
Oct 17, 2019
Oct 13, 2019
Mar 18, 2019
Mar 18, 2019
Oct 17, 2019

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.