diff --git a/api/client/lib/pause.go b/api/client/lib/pause.go new file mode 100644 index 0000000000..3247ec3a57 --- /dev/null +++ b/api/client/lib/pause.go @@ -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 +} diff --git a/api/client/pause.go b/api/client/pause.go index e144a0bd55..76de3e3d59 100644 --- a/api/client/pause.go +++ b/api/client/pause.go @@ -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 {