@@ -27,6 +27,7 @@ type updateOptions struct {
2727 memorySwap opts.MemSwapBytes
2828 kernelMemory opts.MemBytes
2929 restartPolicy string
30+ pidsLimit int64
3031 cpus opts.NanoCPUs
3132
3233 nFlag int
@@ -65,6 +66,8 @@ func NewUpdateCommand(dockerCli command.Cli) *cobra.Command {
6566 flags .Var (& options .memorySwap , "memory-swap" , "Swap limit equal to memory plus swap: '-1' to enable unlimited swap" )
6667 flags .Var (& options .kernelMemory , "kernel-memory" , "Kernel memory limit" )
6768 flags .StringVar (& options .restartPolicy , "restart" , "" , "Restart policy to apply when a container exits" )
69+ flags .Int64Var (& options .pidsLimit , "pids-limit" , 0 , "Tune container pids limit (set -1 for unlimited)" )
70+ flags .SetAnnotation ("pids-limit" , "version" , []string {"1.40" })
6871
6972 flags .Var (& options .cpus , "cpus" , "Number of CPUs" )
7073 flags .SetAnnotation ("cpus" , "version" , []string {"1.29" })
@@ -103,6 +106,10 @@ func runUpdate(dockerCli command.Cli, options *updateOptions) error {
103106 NanoCPUs : options .cpus .Value (),
104107 }
105108
109+ if options .pidsLimit != 0 {
110+ resources .PidsLimit = & options .pidsLimit
111+ }
112+
106113 updateConfig := containertypes.UpdateConfig {
107114 Resources : resources ,
108115 RestartPolicy : restartPolicy ,
0 commit comments