mirror of https://github.com/docker/cli.git
Add `--pids-limit` flag to `docker update`
Signed-off-by: Sunny Gogoi <indiasuny000@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
774d78fcb8
commit
de3a5f0fe5
|
@ -27,6 +27,7 @@ type updateOptions struct {
|
||||||
memorySwap opts.MemSwapBytes
|
memorySwap opts.MemSwapBytes
|
||||||
kernelMemory opts.MemBytes
|
kernelMemory opts.MemBytes
|
||||||
restartPolicy string
|
restartPolicy string
|
||||||
|
pidsLimit int64
|
||||||
cpus opts.NanoCPUs
|
cpus opts.NanoCPUs
|
||||||
|
|
||||||
nFlag int
|
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.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.Var(&options.kernelMemory, "kernel-memory", "Kernel memory limit")
|
||||||
flags.StringVar(&options.restartPolicy, "restart", "", "Restart policy to apply when a container exits")
|
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.Var(&options.cpus, "cpus", "Number of CPUs")
|
||||||
flags.SetAnnotation("cpus", "version", []string{"1.29"})
|
flags.SetAnnotation("cpus", "version", []string{"1.29"})
|
||||||
|
@ -103,6 +106,10 @@ func runUpdate(dockerCli command.Cli, options *updateOptions) error {
|
||||||
NanoCPUs: options.cpus.Value(),
|
NanoCPUs: options.cpus.Value(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.pidsLimit != 0 {
|
||||||
|
resources.PidsLimit = &options.pidsLimit
|
||||||
|
}
|
||||||
|
|
||||||
updateConfig := containertypes.UpdateConfig{
|
updateConfig := containertypes.UpdateConfig{
|
||||||
Resources: resources,
|
Resources: resources,
|
||||||
RestartPolicy: restartPolicy,
|
RestartPolicy: restartPolicy,
|
||||||
|
|
|
@ -2231,6 +2231,7 @@ _docker_container_update() {
|
||||||
--memory -m
|
--memory -m
|
||||||
--memory-reservation
|
--memory-reservation
|
||||||
--memory-swap
|
--memory-swap
|
||||||
|
--pids-limit
|
||||||
--restart
|
--restart
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
|
@ -676,6 +676,7 @@ __docker_container_subcommand() {
|
||||||
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
|
"($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: "
|
||||||
"($help)--memory-reservation=[Memory soft limit]:Memory limit: "
|
"($help)--memory-reservation=[Memory soft limit]:Memory limit: "
|
||||||
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
|
"($help)--memory-swap=[Total memory limit with swap]:Memory limit: "
|
||||||
|
"($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]"
|
||||||
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
|
"($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)"
|
||||||
)
|
)
|
||||||
opts_help=("(: -)--help[Print usage]")
|
opts_help=("(: -)--help[Print usage]")
|
||||||
|
|
|
@ -35,6 +35,7 @@ Options:
|
||||||
-m, --memory string Memory limit
|
-m, --memory string Memory limit
|
||||||
--memory-reservation string Memory soft limit
|
--memory-reservation string Memory soft limit
|
||||||
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
|
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap
|
||||||
|
--pids-limit int Tune container pids limit (set -1 for unlimited)
|
||||||
--restart string Restart policy to apply when a container exits
|
--restart string Restart policy to apply when a container exits
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue