github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/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 Usage: docker update [OPTIONS] CONTAINER [CONTAINER...] 14 15 Update configuration of one or more containers 16 17 --help=false Print usage 18 --blkio-weight=0 Block IO (relative weight), between 10 and 1000 19 --cpu-shares=0 CPU shares (relative weight) 20 --cpu-period=0 Limit the CPU CFS (Completely Fair Scheduler) period 21 --cpu-quota=0 Limit the CPU CFS (Completely Fair Scheduler) quota 22 --cpuset-cpus="" CPUs in which to allow execution (0-3, 0,1) 23 --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1) 24 -m, --memory="" Memory limit 25 --memory-reservation="" Memory soft limit 26 --memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap 27 --kernel-memory="" Kernel memory limit: container must be stopped 28 --restart Restart policy to apply when a container exits 29 30 The `docker update` command dynamically updates container configuration. 31 You can use this command to prevent containers from consuming too many resources 32 from their Docker host. With a single command, you can place limits on 33 a single container or on many. To specify more than one container, provide 34 space-separated list of container names or IDs. 35 36 With the exception of the `--kernel-memory` value, you can specify these 37 options on a running or a stopped container. You can only update 38 `--kernel-memory` on a stopped container. When you run `docker update` on 39 stopped container, the next time you restart it, the container uses those 40 values. 41 42 Another configuration you can change with this command is restart policy, 43 new restart policy will take effect instantly after you run `docker update` 44 on a container. 45 46 ## EXAMPLES 47 48 The following sections illustrate ways to use this command. 49 50 ### Update a container with cpu-shares=512 51 52 To limit a container's cpu-shares to 512, first identify the container 53 name or ID. You can use **docker ps** to find these values. You can also 54 use the ID returned from the **docker run** command. Then, do the following: 55 56 ```bash 57 $ docker update --cpu-shares 512 abebf7571666 58 ``` 59 60 ### Update a container with cpu-shares and memory 61 62 To update multiple resource configurations for multiple containers: 63 64 ```bash 65 $ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse 66 ``` 67 68 ### Update a container's restart policy 69 70 To update restart policy for one or more containers: 71 ```bash 72 $ docker update --restart=on-failure:3 abebf7571666 hopeful_morse 73 ```