mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update api/client file to use context
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
48339017db
commit
8567286ed6
34 changed files with 117 additions and 59 deletions
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -24,7 +26,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
|
||||||
|
|
||||||
cmd.ParseFlags(args, true)
|
cmd.ParseFlags(args, true)
|
||||||
|
|
||||||
c, err := cli.client.ContainerInspect(cmd.Arg(0))
|
c, err := cli.client.ContainerInspect(context.Background(), cmd.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -64,7 +66,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
|
||||||
defer signal.StopCatch(sigc)
|
defer signal.StopCatch(sigc)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.client.ContainerAttach(options)
|
resp, err := cli.client.ContainerAttach(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -73,7 +75,7 @@ func (cli *DockerCli) CmdCommit(args ...string) error {
|
||||||
Config: config,
|
Config: config,
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := cli.client.ContainerCommit(options)
|
response, err := cli.client.ContainerCommit(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ func splitCpArg(arg string) (container, path string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DockerCli) statContainerPath(containerName, path string) (types.ContainerPathStat, error) {
|
func (cli *DockerCli) statContainerPath(containerName, path string) (types.ContainerPathStat, error) {
|
||||||
return cli.client.ContainerStatPath(containerName, path)
|
return cli.client.ContainerStatPath(context.Background(), containerName, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveLocalPath(localPath string) (absPath string, err error) {
|
func resolveLocalPath(localPath string) (absPath string, err error) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ func (cli *DockerCli) createContainer(config *container.Config, hostConfig *cont
|
||||||
}
|
}
|
||||||
|
|
||||||
//create the container
|
//create the container
|
||||||
response, err := cli.client.ContainerCreate(config, hostConfig, networkingConfig, name)
|
response, err := cli.client.ContainerCreate(context.Background(), config, hostConfig, networkingConfig, name)
|
||||||
|
|
||||||
//if image not found try to pull it
|
//if image not found try to pull it
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -129,7 +129,7 @@ func (cli *DockerCli) createContainer(config *container.Config, hostConfig *cont
|
||||||
}
|
}
|
||||||
// Retry
|
// Retry
|
||||||
var retryErr error
|
var retryErr error
|
||||||
response, retryErr = cli.client.ContainerCreate(config, hostConfig, networkingConfig, name)
|
response, retryErr = cli.client.ContainerCreate(context.Background(), config, hostConfig, networkingConfig, name)
|
||||||
if retryErr != nil {
|
if retryErr != nil {
|
||||||
return nil, retryErr
|
return nil, retryErr
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package client
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -25,7 +27,7 @@ func (cli *DockerCli) CmdDiff(args ...string) error {
|
||||||
return fmt.Errorf("Container name cannot be empty")
|
return fmt.Errorf("Container name cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
changes, err := cli.client.ContainerDiff(cmd.Arg(0))
|
changes, err := cli.client.ContainerDiff(context.Background(), cmd.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -31,7 +33,7 @@ func (cli *DockerCli) CmdExec(args ...string) error {
|
||||||
// Send client escape keys
|
// Send client escape keys
|
||||||
execConfig.DetachKeys = cli.configFile.DetachKeys
|
execConfig.DetachKeys = cli.configFile.DetachKeys
|
||||||
|
|
||||||
response, err := cli.client.ContainerExecCreate(*execConfig)
|
response, err := cli.client.ContainerExecCreate(context.Background(), *execConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -53,7 +55,7 @@ func (cli *DockerCli) CmdExec(args ...string) error {
|
||||||
Tty: execConfig.Tty,
|
Tty: execConfig.Tty,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cli.client.ContainerExecStart(execID, execStartCheck); err != nil {
|
if err := cli.client.ContainerExecStart(context.Background(), execID, execStartCheck); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// For now don't print this - wait for when we support exec wait()
|
// For now don't print this - wait for when we support exec wait()
|
||||||
|
@ -82,7 +84,7 @@ func (cli *DockerCli) CmdExec(args ...string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.client.ContainerExecAttach(execID, *execConfig)
|
resp, err := cli.client.ContainerExecAttach(context.Background(), execID, *execConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
|
@ -26,7 +28,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
||||||
|
|
||||||
cmd.ParseFlags(args, true)
|
cmd.ParseFlags(args, true)
|
||||||
|
|
||||||
history, err := cli.client.ImageHistory(cmd.Arg(0))
|
history, err := cli.client.ImageHistory(context.Background(), cmd.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/docker/docker/api/client/formatter"
|
"github.com/docker/docker/api/client/formatter"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
|
@ -48,7 +50,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
||||||
Filters: imageFilterArgs,
|
Filters: imageFilterArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
images, err := cli.client.ImageList(options)
|
images, err := cli.client.ImageList(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -20,7 +22,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
||||||
|
|
||||||
cmd.ParseFlags(args, true)
|
cmd.ParseFlags(args, true)
|
||||||
|
|
||||||
info, err := cli.client.Info()
|
info, err := cli.client.Info(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package client
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/docker/docker/api/client/inspect"
|
"github.com/docker/docker/api/client/inspect"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -41,23 +43,23 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
||||||
|
|
||||||
func (cli *DockerCli) inspectContainers(getSize bool) inspectSearcher {
|
func (cli *DockerCli) inspectContainers(getSize bool) inspectSearcher {
|
||||||
return func(ref string) (interface{}, []byte, error) {
|
return func(ref string) (interface{}, []byte, error) {
|
||||||
return cli.client.ContainerInspectWithRaw(ref, getSize)
|
return cli.client.ContainerInspectWithRaw(context.Background(), ref, getSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DockerCli) inspectImages(getSize bool) inspectSearcher {
|
func (cli *DockerCli) inspectImages(getSize bool) inspectSearcher {
|
||||||
return func(ref string) (interface{}, []byte, error) {
|
return func(ref string) (interface{}, []byte, error) {
|
||||||
return cli.client.ImageInspectWithRaw(ref, getSize)
|
return cli.client.ImageInspectWithRaw(context.Background(), ref, getSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *DockerCli) inspectAll(getSize bool) inspectSearcher {
|
func (cli *DockerCli) inspectAll(getSize bool) inspectSearcher {
|
||||||
return func(ref string) (interface{}, []byte, error) {
|
return func(ref string) (interface{}, []byte, error) {
|
||||||
c, rawContainer, err := cli.client.ContainerInspectWithRaw(ref, getSize)
|
c, rawContainer, err := cli.client.ContainerInspectWithRaw(context.Background(), ref, getSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Search for image with that id if a container doesn't exist.
|
// Search for image with that id if a container doesn't exist.
|
||||||
if client.IsErrContainerNotFound(err) {
|
if client.IsErrContainerNotFound(err) {
|
||||||
i, rawImage, err := cli.client.ImageInspectWithRaw(ref, getSize)
|
i, rawImage, err := cli.client.ImageInspectWithRaw(context.Background(), ref, getSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if client.IsErrImageNotFound(err) {
|
if client.IsErrImageNotFound(err) {
|
||||||
return nil, nil, fmt.Errorf("Error: No such image or container: %s", ref)
|
return nil, nil, fmt.Errorf("Error: No such image or container: %s", ref)
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +22,7 @@ func (cli *DockerCli) CmdKill(args ...string) error {
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.ContainerKill(name, *signal); err != nil {
|
if err := cli.client.ContainerKill(context.Background(), name, *signal); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -8,6 +8,8 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/cliconfig"
|
"github.com/docker/docker/cliconfig"
|
||||||
"github.com/docker/docker/cliconfig/credentials"
|
"github.com/docker/docker/cliconfig/credentials"
|
||||||
|
@ -52,7 +54,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := cli.client.RegistryLogin(authConfig)
|
response, err := cli.client.RegistryLogin(context.Background(), authConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
|
||||||
|
|
||||||
name := cmd.Arg(0)
|
name := cmd.Arg(0)
|
||||||
|
|
||||||
c, err := cli.client.ContainerInspect(name)
|
c, err := cli.client.ContainerInspect(context.Background(), name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -82,7 +84,7 @@ func (cli *DockerCli) CmdNetworkCreate(args ...string) error {
|
||||||
EnableIPv6: *flIPv6,
|
EnableIPv6: *flIPv6,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.client.NetworkCreate(nc)
|
resp, err := cli.client.NetworkCreate(context.Background(), nc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -102,7 +104,7 @@ func (cli *DockerCli) CmdNetworkRm(args ...string) error {
|
||||||
|
|
||||||
status := 0
|
status := 0
|
||||||
for _, net := range cmd.Args() {
|
for _, net := range cmd.Args() {
|
||||||
if err := cli.client.NetworkRemove(net); err != nil {
|
if err := cli.client.NetworkRemove(context.Background(), net); err != nil {
|
||||||
fmt.Fprintf(cli.err, "%s\n", err)
|
fmt.Fprintf(cli.err, "%s\n", err)
|
||||||
status = 1
|
status = 1
|
||||||
continue
|
continue
|
||||||
|
@ -137,7 +139,7 @@ func (cli *DockerCli) CmdNetworkConnect(args ...string) error {
|
||||||
Links: flLinks.GetAll(),
|
Links: flLinks.GetAll(),
|
||||||
Aliases: flAliases.GetAll(),
|
Aliases: flAliases.GetAll(),
|
||||||
}
|
}
|
||||||
return cli.client.NetworkConnect(cmd.Arg(0), cmd.Arg(1), epConfig)
|
return cli.client.NetworkConnect(context.Background(), cmd.Arg(0), cmd.Arg(1), epConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdNetworkDisconnect disconnects a container from a network
|
// CmdNetworkDisconnect disconnects a container from a network
|
||||||
|
@ -151,7 +153,7 @@ func (cli *DockerCli) CmdNetworkDisconnect(args ...string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.client.NetworkDisconnect(cmd.Arg(0), cmd.Arg(1), *force)
|
return cli.client.NetworkDisconnect(context.Background(), cmd.Arg(0), cmd.Arg(1), *force)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CmdNetworkLs lists all the networks managed by docker daemon
|
// CmdNetworkLs lists all the networks managed by docker daemon
|
||||||
|
@ -184,7 +186,7 @@ func (cli *DockerCli) CmdNetworkLs(args ...string) error {
|
||||||
Filters: netFilterArgs,
|
Filters: netFilterArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
networkResources, err := cli.client.NetworkList(options)
|
networkResources, err := cli.client.NetworkList(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -236,7 +238,7 @@ func (cli *DockerCli) CmdNetworkInspect(args ...string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
inspectSearcher := func(name string) (interface{}, []byte, error) {
|
inspectSearcher := func(name string) (interface{}, []byte, error) {
|
||||||
i, err := cli.client.NetworkInspect(name)
|
i, err := cli.client.NetworkInspect(context.Background(), name)
|
||||||
return i, nil, err
|
return i, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -19,7 +21,7 @@ func (cli *DockerCli) CmdPause(args ...string) error {
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.ContainerPause(name); err != nil {
|
if err := cli.client.ContainerPause(context.Background(), name); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
|
@ -19,7 +21,7 @@ func (cli *DockerCli) CmdPort(args ...string) error {
|
||||||
|
|
||||||
cmd.ParseFlags(args, true)
|
cmd.ParseFlags(args, true)
|
||||||
|
|
||||||
c, err := cli.client.ContainerInspect(cmd.Arg(0))
|
c, err := cli.client.ContainerInspect(context.Background(), cmd.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/docker/docker/api/client/formatter"
|
"github.com/docker/docker/api/client/formatter"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
|
@ -56,7 +58,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
||||||
Filter: psFilterArgs,
|
Filter: psFilterArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
containers, err := cli.client.ContainerList(options)
|
containers, err := cli.client.ContainerList(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -24,7 +26,7 @@ func (cli *DockerCli) CmdRename(args ...string) error {
|
||||||
return fmt.Errorf("Error: Neither old nor new names may be empty")
|
return fmt.Errorf("Error: Neither old nor new names may be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cli.client.ContainerRename(oldName, newName); err != nil {
|
if err := cli.client.ContainerRename(context.Background(), oldName, newName); err != nil {
|
||||||
fmt.Fprintf(cli.err, "%s\n", err)
|
fmt.Fprintf(cli.err, "%s\n", err)
|
||||||
return fmt.Errorf("Error: failed to rename container named %s", oldName)
|
return fmt.Errorf("Error: failed to rename container named %s", oldName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +22,7 @@ func (cli *DockerCli) CmdRestart(args ...string) error {
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.ContainerRestart(name, *nSeconds); err != nil {
|
if err := cli.client.ContainerRestart(context.Background(), name, *nSeconds); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/engine-api/types"
|
"github.com/docker/engine-api/types"
|
||||||
|
@ -47,7 +49,7 @@ func (cli *DockerCli) removeContainer(containerID string, removeVolumes, removeL
|
||||||
RemoveLinks: removeLinks,
|
RemoveLinks: removeLinks,
|
||||||
Force: force,
|
Force: force,
|
||||||
}
|
}
|
||||||
if err := cli.client.ContainerRemove(options); err != nil {
|
if err := cli.client.ContainerRemove(context.Background(), options); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/engine-api/types"
|
"github.com/docker/engine-api/types"
|
||||||
|
@ -37,7 +39,7 @@ func (cli *DockerCli) CmdRmi(args ...string) error {
|
||||||
PruneChildren: !*noprune,
|
PruneChildren: !*noprune,
|
||||||
}
|
}
|
||||||
|
|
||||||
dels, err := cli.client.ImageRemove(options)
|
dels, err := cli.client.ImageRemove(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -203,7 +203,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
DetachKeys: cli.configFile.DetachKeys,
|
DetachKeys: cli.configFile.DetachKeys,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.client.ContainerAttach(options)
|
resp, err := cli.client.ContainerAttach(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
//start the container
|
//start the container
|
||||||
if err := cli.client.ContainerStart(createResponse.ID); err != nil {
|
if err := cli.client.ContainerStart(context.Background(), createResponse.ID); err != nil {
|
||||||
cmd.ReportError(err.Error(), false)
|
cmd.ReportError(err.Error(), false)
|
||||||
return runStartContainerErr(err)
|
return runStartContainerErr(err)
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
// Attached mode
|
// Attached mode
|
||||||
if *flAutoRemove {
|
if *flAutoRemove {
|
||||||
// Warn user if they detached us
|
// Warn user if they detached us
|
||||||
js, err := cli.client.ContainerInspect(createResponse.ID)
|
js, err := cli.client.ContainerInspect(context.Background(), createResponse.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return runStartContainerErr(err)
|
return runStartContainerErr(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/pkg/stringutils"
|
"github.com/docker/docker/pkg/stringutils"
|
||||||
|
@ -49,7 +51,7 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
|
||||||
RegistryAuth: encodedAuth,
|
RegistryAuth: encodedAuth,
|
||||||
}
|
}
|
||||||
|
|
||||||
unorderedResults, err := cli.client.ImageSearch(options, requestPrivilege)
|
unorderedResults, err := cli.client.ImageSearch(context.Background(), options, requestPrivilege)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -34,7 +36,7 @@ func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cli.client.ContainerKill(cid, sig); err != nil {
|
if err := cli.client.ContainerKill(context.Background(), cid, sig); err != nil {
|
||||||
logrus.Debugf("Error sending signal: %s", err)
|
logrus.Debugf("Error sending signal: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +65,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
|
||||||
|
|
||||||
// 2. Attach to the container.
|
// 2. Attach to the container.
|
||||||
containerID := cmd.Arg(0)
|
containerID := cmd.Arg(0)
|
||||||
c, err := cli.client.ContainerInspect(containerID)
|
c, err := cli.client.ContainerInspect(context.Background(), containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -91,7 +93,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
|
||||||
in = cli.in
|
in = cli.in
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := cli.client.ContainerAttach(options)
|
resp, err := cli.client.ContainerAttach(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
|
||||||
})
|
})
|
||||||
|
|
||||||
// 3. Start the container.
|
// 3. Start the container.
|
||||||
if err := cli.client.ContainerStart(containerID); err != nil {
|
if err := cli.client.ContainerStart(context.Background(), containerID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +142,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
|
||||||
func (cli *DockerCli) startContainersWithoutAttachments(containerIDs []string) error {
|
func (cli *DockerCli) startContainersWithoutAttachments(containerIDs []string) error {
|
||||||
var failedContainers []string
|
var failedContainers []string
|
||||||
for _, containerID := range containerIDs {
|
for _, containerID := range containerIDs {
|
||||||
if err := cli.client.ContainerStart(containerID); err != nil {
|
if err := cli.client.ContainerStart(context.Background(), containerID); err != nil {
|
||||||
fmt.Fprintf(cli.err, "%s\n", err)
|
fmt.Fprintf(cli.err, "%s\n", err)
|
||||||
failedContainers = append(failedContainers, containerID)
|
failedContainers = append(failedContainers, containerID)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -70,7 +70,7 @@ func (cli *DockerCli) CmdStats(args ...string) error {
|
||||||
options := types.ContainerListOptions{
|
options := types.ContainerListOptions{
|
||||||
All: *all,
|
All: *all,
|
||||||
}
|
}
|
||||||
cs, err := cli.client.ContainerList(options)
|
cs, err := cli.client.ContainerList(context.Background(), options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
closeChan <- err
|
closeChan <- err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -22,7 +24,7 @@ func (cli *DockerCli) CmdStop(args ...string) error {
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.ContainerStop(name, *nSeconds); err != nil {
|
if err := cli.client.ContainerStop(context.Background(), name, *nSeconds); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package client
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/reference"
|
"github.com/docker/docker/reference"
|
||||||
|
@ -40,5 +42,5 @@ func (cli *DockerCli) CmdTag(args ...string) error {
|
||||||
Force: *force,
|
Force: *force,
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.client.ImageTag(options)
|
return cli.client.ImageTag(context.Background(), options)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -23,7 +25,7 @@ func (cli *DockerCli) CmdTop(args ...string) error {
|
||||||
arguments = cmd.Args()[1:]
|
arguments = cmd.Args()[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
procList, err := cli.client.ContainerTop(cmd.Arg(0), arguments)
|
procList, err := cli.client.ContainerTop(context.Background(), cmd.Arg(0), arguments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
"github.com/docker/distribution/registry/client/auth"
|
"github.com/docker/distribution/registry/client/auth"
|
||||||
|
@ -276,7 +278,7 @@ func (cli *DockerCli) tagTrusted(trustedRef reference.Canonical, ref reference.N
|
||||||
Force: true,
|
Force: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
return cli.client.ImageTag(options)
|
return cli.client.ImageTag(context.Background(), options)
|
||||||
}
|
}
|
||||||
|
|
||||||
func notaryError(repoName string, err error) error {
|
func notaryError(repoName string, err error) error {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
@ -19,7 +21,7 @@ func (cli *DockerCli) CmdUnpause(args ...string) error {
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.ContainerUnpause(name); err != nil {
|
if err := cli.client.ContainerUnpause(context.Background(), name); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
"github.com/docker/docker/runconfig/opts"
|
"github.com/docker/docker/runconfig/opts"
|
||||||
|
@ -100,7 +102,7 @@ func (cli *DockerCli) CmdUpdate(args ...string) error {
|
||||||
names := cmd.Args()
|
names := cmd.Args()
|
||||||
var errs []string
|
var errs []string
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
if err := cli.client.ContainerUpdate(name, updateConfig); err != nil {
|
if err := cli.client.ContainerUpdate(context.Background(), name, updateConfig); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(cli.out, "%s\n", name)
|
fmt.Fprintf(cli.out, "%s\n", name)
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/docker/pkg/signal"
|
"github.com/docker/docker/pkg/signal"
|
||||||
"github.com/docker/docker/pkg/term"
|
"github.com/docker/docker/pkg/term"
|
||||||
|
@ -27,7 +29,7 @@ func (cli *DockerCli) electAuthServer() string {
|
||||||
// example a Linux client might be interacting with a Windows daemon, hence
|
// example a Linux client might be interacting with a Windows daemon, hence
|
||||||
// the default registry URL might be Windows specific.
|
// the default registry URL might be Windows specific.
|
||||||
serverAddress := registry.IndexServer
|
serverAddress := registry.IndexServer
|
||||||
if info, err := cli.client.Info(); err != nil {
|
if info, err := cli.client.Info(context.Background()); err != nil {
|
||||||
fmt.Fprintf(cli.out, "Warning: failed to get default registry endpoint from daemon (%v). Using system default: %s\n", err, serverAddress)
|
fmt.Fprintf(cli.out, "Warning: failed to get default registry endpoint from daemon (%v). Using system default: %s\n", err, serverAddress)
|
||||||
} else {
|
} else {
|
||||||
serverAddress = info.IndexServerAddress
|
serverAddress = info.IndexServerAddress
|
||||||
|
@ -74,9 +76,9 @@ func (cli *DockerCli) resizeTtyTo(id string, height, width int, isExec bool) {
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
if isExec {
|
if isExec {
|
||||||
err = cli.client.ContainerExecResize(options)
|
err = cli.client.ContainerExecResize(context.Background(), options)
|
||||||
} else {
|
} else {
|
||||||
err = cli.client.ContainerResize(options)
|
err = cli.client.ContainerResize(context.Background(), options)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -87,7 +89,7 @@ func (cli *DockerCli) resizeTtyTo(id string, height, width int, isExec bool) {
|
||||||
// getExitCode perform an inspect on the container. It returns
|
// getExitCode perform an inspect on the container. It returns
|
||||||
// the running state and the exit code.
|
// the running state and the exit code.
|
||||||
func getExitCode(cli *DockerCli, containerID string) (bool, int, error) {
|
func getExitCode(cli *DockerCli, containerID string) (bool, int, error) {
|
||||||
c, err := cli.client.ContainerInspect(containerID)
|
c, err := cli.client.ContainerInspect(context.Background(), containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// If we can't connect, then the daemon probably died.
|
// If we can't connect, then the daemon probably died.
|
||||||
if err != client.ErrConnectionFailed {
|
if err != client.ErrConnectionFailed {
|
||||||
|
@ -102,7 +104,7 @@ func getExitCode(cli *DockerCli, containerID string) (bool, int, error) {
|
||||||
// getExecExitCode perform an inspect on the exec command. It returns
|
// getExecExitCode perform an inspect on the exec command. It returns
|
||||||
// the running state and the exit code.
|
// the running state and the exit code.
|
||||||
func getExecExitCode(cli *DockerCli, execID string) (bool, int, error) {
|
func getExecExitCode(cli *DockerCli, execID string) (bool, int, error) {
|
||||||
resp, err := cli.client.ContainerExecInspect(execID)
|
resp, err := cli.client.ContainerExecInspect(context.Background(), execID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// If we can't connect, then the daemon probably died.
|
// If we can't connect, then the daemon probably died.
|
||||||
if err != client.ErrConnectionFailed {
|
if err != client.ErrConnectionFailed {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -67,7 +69,7 @@ func (cli *DockerCli) CmdVersion(args ...string) (err error) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
serverVersion, err := cli.client.ServerVersion()
|
serverVersion, err := cli.client.ServerVersion(context.Background())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
vd.Server = &serverVersion
|
vd.Server = &serverVersion
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
Cli "github.com/docker/docker/cli"
|
Cli "github.com/docker/docker/cli"
|
||||||
"github.com/docker/docker/opts"
|
"github.com/docker/docker/opts"
|
||||||
flag "github.com/docker/docker/pkg/mflag"
|
flag "github.com/docker/docker/pkg/mflag"
|
||||||
|
@ -59,7 +61,7 @@ func (cli *DockerCli) CmdVolumeLs(args ...string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
volumes, err := cli.client.VolumeList(volFilterArgs)
|
volumes, err := cli.client.VolumeList(context.Background(), volFilterArgs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,7 @@ func (cli *DockerCli) CmdVolumeInspect(args ...string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
inspectSearcher := func(name string) (interface{}, []byte, error) {
|
inspectSearcher := func(name string) (interface{}, []byte, error) {
|
||||||
i, err := cli.client.VolumeInspect(name)
|
i, err := cli.client.VolumeInspect(context.Background(), name)
|
||||||
return i, nil, err
|
return i, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ func (cli *DockerCli) CmdVolumeCreate(args ...string) error {
|
||||||
Name: *flName,
|
Name: *flName,
|
||||||
}
|
}
|
||||||
|
|
||||||
vol, err := cli.client.VolumeCreate(volReq)
|
vol, err := cli.client.VolumeCreate(context.Background(), volReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -155,7 +157,7 @@ func (cli *DockerCli) CmdVolumeRm(args ...string) error {
|
||||||
var status = 0
|
var status = 0
|
||||||
|
|
||||||
for _, name := range cmd.Args() {
|
for _, name := range cmd.Args() {
|
||||||
if err := cli.client.VolumeRemove(name); err != nil {
|
if err := cli.client.VolumeRemove(context.Background(), name); err != nil {
|
||||||
fmt.Fprintf(cli.err, "%s\n", err)
|
fmt.Fprintf(cli.err, "%s\n", err)
|
||||||
status = 1
|
status = 1
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Reference in a new issue