github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/client/container_update.go (about)

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