github.com/a4a881d4/docker@v1.9.0-rc2/api/client/unpause.go (about)

     1  package client
     2  
     3  import (
     4  	"fmt"
     5  
     6  	Cli "github.com/docker/docker/cli"
     7  	flag "github.com/docker/docker/pkg/mflag"
     8  )
     9  
    10  // CmdUnpause unpauses all processes within a container, for one or more containers.
    11  //
    12  // Usage: docker unpause CONTAINER [CONTAINER...]
    13  func (cli *DockerCli) CmdUnpause(args ...string) error {
    14  	cmd := Cli.Subcmd("unpause", []string{"CONTAINER [CONTAINER...]"}, Cli.DockerCommands["unpause"].Description, true)
    15  	cmd.Require(flag.Min, 1)
    16  
    17  	cmd.ParseFlags(args, true)
    18  
    19  	var errNames []string
    20  	for _, name := range cmd.Args() {
    21  		if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/unpause", name), nil, nil)); err != nil {
    22  			fmt.Fprintf(cli.err, "%s\n", err)
    23  			errNames = append(errNames, name)
    24  		} else {
    25  			fmt.Fprintf(cli.out, "%s\n", name)
    26  		}
    27  	}
    28  	if len(errNames) > 0 {
    29  		return fmt.Errorf("Error: failed to unpause containers: %v", errNames)
    30  	}
    31  	return nil
    32  }