github.com/docker/docker-ce@v17.12.1-ce-rc2+incompatible/components/cli/man/src/container/update.md (about) 1 The **docker container update** command dynamically updates container configuration. 2 You can use this command to prevent containers from consuming too many 3 resources from their Docker host. With a single command, you can place 4 limits on a single container or on many. To specify more than one container, 5 provide space-separated list of container names or IDs. 6 7 With the exception of the **--kernel-memory** option, you can specify these 8 options on a running or a stopped container. On kernel version older than 9 4.6, You can only update **--kernel-memory** on a stopped container or on 10 a running container with kernel memory initialized. 11 12 # OPTIONS 13 14 ## kernel-memory 15 16 Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g) 17 18 Note that on kernel version older than 4.6, you can not update kernel memory on 19 a running container if the container is started without kernel memory initialized, 20 in this case, it can only be updated after it's stopped. The new setting takes 21 effect when the container is started. 22 23 ## memory 24 25 Memory limit (format: <number><optional unit>, where unit = b, k, m or g) 26 27 Note that the memory should be smaller than the already set swap memory limit. 28 If you want update a memory limit bigger than the already set swap memory limit, 29 you should update swap memory limit at the same time. If you don't set swap memory 30 limit on docker create/run but only memory limit, the swap memory is double 31 the memory limit. 32 33 # EXAMPLES 34 35 The following sections illustrate ways to use this command. 36 37 ### Update a container's cpu-shares 38 39 To limit a container's cpu-shares to 512, first identify the container 40 name or ID. You can use **docker ps** to find these values. You can also 41 use the ID returned from the **docker run** command. Then, do the following: 42 43 ```bash 44 $ docker container update --cpu-shares 512 abebf7571666 45 ``` 46 47 ### Update a container with cpu-shares and memory 48 49 To update multiple resource configurations for multiple containers: 50 51 ```bash 52 $ docker container update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse 53 ``` 54 55 ### Update a container's kernel memory constraints 56 57 You can update a container's kernel memory limit using the **--kernel-memory** 58 option. On kernel version older than 4.6, this option can be updated on a 59 running container only if the container was started with **--kernel-memory**. 60 If the container was started *without* **--kernel-memory** you need to stop 61 the container before updating kernel memory. 62 63 For example, if you started a container with this command: 64 65 ```bash 66 $ docker run -dit --name test --kernel-memory 50M ubuntu bash 67 ``` 68 69 You can update kernel memory while the container is running: 70 71 ```bash 72 $ docker container update --kernel-memory 80M test 73 ``` 74 75 If you started a container *without* kernel memory initialized: 76 77 ```bash 78 $ docker run -dit --name test2 --memory 300M ubuntu bash 79 ``` 80 81 Update kernel memory of running container `test2` will fail. You need to stop 82 the container before updating the **--kernel-memory** setting. The next time you 83 start it, the container uses the new value. 84 85 Kernel version newer than (include) 4.6 does not have this limitation, you 86 can use `--kernel-memory` the same way as other options. 87 88 ### Update a container's restart policy 89 90 You can change a container's restart policy on a running container. The new 91 restart policy takes effect instantly after you run `docker container update` on a 92 container. 93 94 To update restart policy for one or more containers: 95 96 ```bash 97 $ docker container update --restart=on-failure:3 abebf7571666 hopeful_morse 98 ``` 99 100 Note that if the container is started with "--rm" flag, you cannot update the restart 101 policy for it. The `AutoRemove` and `RestartPolicy` are mutually exclusive for the 102 container.