github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/update.md (about) 1 <!--[metadata]> 2 +++ 3 title = "update" 4 description = "The update command description and usage" 5 keywords = ["resources, update, dynamically"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 ## update 12 13 ```markdown 14 Usage: docker update [OPTIONS] CONTAINER [CONTAINER...] 15 16 Update configuration of one or more containers 17 18 Options: 19 --blkio-weight value Block IO (relative weight), between 10 and 1000 20 --cpu-period int Limit CPU CFS (Completely Fair Scheduler) period 21 --cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota 22 -c, --cpu-shares int CPU shares (relative weight) 23 --cpuset-cpus string CPUs in which to allow execution (0-3, 0,1) 24 --cpuset-mems string MEMs in which to allow execution (0-3, 0,1) 25 --help Print usage 26 --kernel-memory string Kernel memory limit 27 -m, --memory string Memory limit 28 --memory-reservation string Memory soft limit 29 --memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap 30 --restart string Restart policy to apply when a container exits 31 ``` 32 33 The `docker update` command dynamically updates container configuration. 34 You can use this command to prevent containers from consuming too many 35 resources from their Docker host. With a single command, you can place 36 limits on a single container or on many. To specify more than one container, 37 provide space-separated list of container names or IDs. 38 39 With the exception of the `--kernel-memory` option, you can specify these 40 options on a running or a stopped container. On kernel version older than 41 4.6, you can only update `--kernel-memory` on a stopped container or on 42 a running container with kernel memory initialized. 43 44 ## EXAMPLES 45 46 The following sections illustrate ways to use this command. 47 48 ### Update a container's cpu-shares 49 50 To limit a container's cpu-shares to 512, first identify the container 51 name or ID. You can use `docker ps` to find these values. You can also 52 use the ID returned from the `docker run` command. Then, do the following: 53 54 ```bash 55 $ docker update --cpu-shares 512 abebf7571666 56 ``` 57 58 ### Update a container with cpu-shares and memory 59 60 To update multiple resource configurations for multiple containers: 61 62 ```bash 63 $ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse 64 ``` 65 66 ### Update a container's kernel memory constraints 67 68 You can update a container's kernel memory limit using the `--kernel-memory` 69 option. On kernel version older than 4.6, this option can be updated on a 70 running container only if the container was started with `--kernel-memory`. 71 If the container was started *without* `--kernel-memory` you need to stop 72 the container before updating kernel memory. 73 74 For example, if you started a container with this command: 75 76 ```bash 77 $ docker run -dit --name test --kernel-memory 50M ubuntu bash 78 ``` 79 80 You can update kernel memory while the container is running: 81 82 ```bash 83 $ docker update --kernel-memory 80M test 84 ``` 85 86 If you started a container *without* kernel memory initialized: 87 88 ```bash 89 $ docker run -dit --name test2 --memory 300M ubuntu bash 90 ``` 91 92 Update kernel memory of running container `test2` will fail. You need to stop 93 the container before updating the `--kernel-memory` setting. The next time you 94 start it, the container uses the new value. 95 96 Kernel version newer than (include) 4.6 does not have this limitation, you 97 can use `--kernel-memory` the same way as other options. 98 99 ### Update a container's restart policy 100 101 You can change a container's restart policy on a running container. The new 102 restart policy takes effect instantly after you run `docker update` on a 103 container. 104 105 To update restart policy for one or more containers: 106 107 ```bash 108 $ docker update --restart=on-failure:3 abebf7571666 hopeful_morse 109 ```