mirror of
https://github.com/docker/cli.git
synced 2026-01-06 05:41:44 +03:00
Update RestartPolicy of container
Add `--restart` flag for `update` command, so we can change restart policy for a container no matter it's running or stopped. Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
@@ -12,7 +12,7 @@ parent = "smn_cli"
|
||||
|
||||
Usage: docker update [OPTIONS] CONTAINER [CONTAINER...]
|
||||
|
||||
Updates container resource limits
|
||||
Update configuration of one or more containers
|
||||
|
||||
--help=false Print usage
|
||||
--blkio-weight=0 Block IO (relative weight), between 10 and 1000
|
||||
@@ -25,11 +25,12 @@ parent = "smn_cli"
|
||||
--memory-reservation="" Memory soft limit
|
||||
--memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap
|
||||
--kernel-memory="" Kernel memory limit: container must be stopped
|
||||
--restart Restart policy to apply when a container exits
|
||||
|
||||
The `docker update` command dynamically updates container resources. Use this
|
||||
command to prevent containers from consuming too many resources from their
|
||||
Docker host. With a single command, you can place limits on a single
|
||||
container or on many. To specify more than one container, provide
|
||||
The `docker update` command dynamically updates container configuration.
|
||||
You can use this command to prevent containers from consuming too many resources
|
||||
from their Docker host. With a single command, you can place limits on
|
||||
a single container or on many. To specify more than one container, provide
|
||||
space-separated list of container names or IDs.
|
||||
|
||||
With the exception of the `--kernel-memory` value, you can specify these
|
||||
@@ -38,6 +39,10 @@ options on a running or a stopped container. You can only update
|
||||
stopped container, the next time you restart it, the container uses those
|
||||
values.
|
||||
|
||||
Another configuration you can change with this command is restart policy,
|
||||
new restart policy will take effect instantly after you run `docker update`
|
||||
on a container.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
The following sections illustrate ways to use this command.
|
||||
@@ -59,3 +64,10 @@ To update multiple resource configurations for multiple containers:
|
||||
```bash
|
||||
$ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse
|
||||
```
|
||||
|
||||
### Update a container's restart policy
|
||||
|
||||
To update restart policy for one or more containers:
|
||||
```bash
|
||||
$ docker update --restart=on-failure:3 abebf7571666 hopeful_morse
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user