github.com/zhouyu0/docker-note@v0.0.0-20190722021225-b8d3825084db/client/container_update.go (about)

     1  package client // import "github.com/docker/docker/client"
     2  
     3  import (
     4  	"context"
     5  	"encoding/json"
     6  
     7  	"github.com/docker/docker/api/types/container"
     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  }