2018-02-05 21:05:59 +00:00
|
|
|
package client // import "github.com/docker/docker/client"
|
2016-09-06 18:46:37 +00:00
|
|
|
|
|
|
|
import (
|
2018-04-19 22:30:59 +00:00
|
|
|
"context"
|
2016-09-06 18:46:37 +00:00
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types/container"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ContainerUpdate updates resources of a container
|
2016-10-19 00:35:45 +00:00
|
|
|
func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
|
|
|
|
var response container.ContainerUpdateOKBody
|
2016-09-06 18:46:37 +00:00
|
|
|
serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil)
|
|
|
|
if err != nil {
|
|
|
|
return response, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = json.NewDecoder(serverResp.body).Decode(&response)
|
|
|
|
|
|
|
|
ensureReaderClosed(serverResp)
|
|
|
|
return response, err
|
|
|
|
}
|