1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Merge pull request #31148 from yongtang/31032-NanoCPU-update

Add `--cpus` support for `docker update`
This commit is contained in:
Sebastiaan van Stijn
2017-04-10 20:02:15 +02:00
committed by GitHub

View File

@@ -28,6 +28,7 @@ type updateOptions struct {
memorySwap opts.MemSwapBytes
kernelMemory opts.MemBytes
restartPolicy string
cpus opts.NanoCPUs
nFlag int
@@ -66,6 +67,9 @@ func NewUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
flags.Var(&opts.kernelMemory, "kernel-memory", "Kernel memory limit")
flags.StringVar(&opts.restartPolicy, "restart", "", "Restart policy to apply when a container exits")
flags.Var(&opts.cpus, "cpus", "Number of CPUs")
flags.SetAnnotation("cpus", "version", []string{"1.29"})
return cmd
}
@@ -97,6 +101,7 @@ func runUpdate(dockerCli *command.DockerCli, opts *updateOptions) error {
CPUQuota: opts.cpuQuota,
CPURealtimePeriod: opts.cpuRealtimePeriod,
CPURealtimeRuntime: opts.cpuRealtimeRuntime,
NanoCPUs: opts.cpus.Value(),
}
updateConfig := containertypes.UpdateConfig{