mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Implement docker pause with standalone client lib.
Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
parent
356768bc01
commit
55333e8f90
2 changed files with 9 additions and 1 deletions
8
api/client/lib/pause.go
Normal file
8
api/client/lib/pause.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
package lib
|
||||
|
||||
// ContainerPause pauses the main process of a given container without terminating it.
|
||||
func (cli *Client) ContainerPause(containerID string) error {
|
||||
resp, err := cli.post("/containers/"+containerID+"/pause", nil, nil, nil)
|
||||
ensureReaderClosed(resp)
|
||||
return err
|
||||
}
|
|
@ -18,7 +18,7 @@ func (cli *DockerCli) CmdPause(args ...string) error {
|
|||
|
||||
var errNames []string
|
||||
for _, name := range cmd.Args() {
|
||||
if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/pause", name), nil, nil)); err != nil {
|
||||
if err := cli.client.ContainerPause(name); err != nil {
|
||||
fmt.Fprintf(cli.err, "%s\n", err)
|
||||
errNames = append(errNames, name)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue