github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/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 defer ensureReaderClosed(serverResp) 15 if err != nil { 16 return response, err 17 } 18 19 err = json.NewDecoder(serverResp.body).Decode(&response) 20 return response, err 21 }