podman
43 строки · 1.4 Кб
1package docker2
3import (4"context"5"fmt"6"net/http"7)
8
9// UpdateContainerOptions specify parameters to the UpdateContainer function.
10//
11// See https://goo.gl/Y6fXUy for more details.
12type UpdateContainerOptions struct {13BlkioWeight int `json:"BlkioWeight"`14CPUShares int `json:"CpuShares"`15CPUPeriod int `json:"CpuPeriod"`16CPURealtimePeriod int64 `json:"CpuRealtimePeriod"`17CPURealtimeRuntime int64 `json:"CpuRealtimeRuntime"`18CPUQuota int `json:"CpuQuota"`19CpusetCpus string `json:"CpusetCpus"`20CpusetMems string `json:"CpusetMems"`21Memory int `json:"Memory"`22MemorySwap int `json:"MemorySwap"`23MemoryReservation int `json:"MemoryReservation"`24KernelMemory int `json:"KernelMemory"`25RestartPolicy RestartPolicy `json:"RestartPolicy,omitempty"`26Context context.Context27}
28
29// UpdateContainer updates the container at ID with the options
30//
31// See https://goo.gl/Y6fXUy for more details.
32func (c *Client) UpdateContainer(id string, opts UpdateContainerOptions) error {33resp, err := c.do(http.MethodPost, fmt.Sprintf("/containers/"+id+"/update"), doOptions{34data: opts,35forceJSON: true,36context: opts.Context,37})38if err != nil {39return err40}41defer resp.Body.Close()42return nil43}
44