Merge pull request #1765 from thaJeztah/carry_181_pids_limit
Add `--pids-limit` flag to `docker update`
This commit is contained in:
@ -27,6 +27,7 @@ type updateOptions struct {
|
||||
memorySwap opts.MemSwapBytes
|
||||
kernelMemory opts.MemBytes
|
||||
restartPolicy string
|
||||
pidsLimit int64
|
||||
cpus opts.NanoCPUs
|
||||
|
||||
nFlag int
|
||||
@ -65,6 +66,8 @@ func NewUpdateCommand(dockerCli command.Cli) *cobra.Command {
|
||||
flags.Var(&options.memorySwap, "memory-swap", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap")
|
||||
flags.Var(&options.kernelMemory, "kernel-memory", "Kernel memory limit")
|
||||
flags.StringVar(&options.restartPolicy, "restart", "", "Restart policy to apply when a container exits")
|
||||
flags.Int64Var(&options.pidsLimit, "pids-limit", 0, "Tune container pids limit (set -1 for unlimited)")
|
||||
flags.SetAnnotation("pids-limit", "version", []string{"1.40"})
|
||||
|
||||
flags.Var(&options.cpus, "cpus", "Number of CPUs")
|
||||
flags.SetAnnotation("cpus", "version", []string{"1.29"})
|
||||
@ -103,6 +106,10 @@ func runUpdate(dockerCli command.Cli, options *updateOptions) error {
|
||||
NanoCPUs: options.cpus.Value(),
|
||||
}
|
||||
|
||||
if options.pidsLimit != 0 {
|
||||
resources.PidsLimit = &options.pidsLimit
|
||||
}
|
||||
|
||||
updateConfig := containertypes.UpdateConfig{
|
||||
Resources: resources,
|
||||
RestartPolicy: restartPolicy,
|
||||
|
||||
Reference in New Issue
Block a user