github.com/rhatdan/docker@v0.7.7-0.20180119204836-47a0dcbcd20a/client/container_update.go (about)

     1  package client
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/docker/docker/api/types/container"
     7  	"golang.org/x/net/context"
     8  )
     9  
    10  // ContainerUpdate updates resources of a container
    11  func (cli *Client) ContainerUpdate(ctx context.Context, containerID string, updateConfig container.UpdateConfig) (container.ContainerUpdateOKBody, error) {
    12  	var response container.ContainerUpdateOKBody
    13  	serverResp, err := cli.post(ctx, "/containers/"+containerID+"/update", nil, updateConfig, nil)
    14  	if err != nil {
    15  		return response, err
    16  	}
    17  
    18  	err = json.NewDecoder(serverResp.body).Decode(&response)
    19  
    20  	ensureReaderClosed(serverResp)
    21  	return response, err
    22  }