1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-update - Update configuration of one or more containers
7
8
9
11 docker update [--blkio-weight[=[BLKIO-WEIGHT]]] [--cpu-shares[=0]]
12 [--cpu-period[=0]] [--cpu-quota[=0]] [--cpu-rt-period[=0]]
13 [--cpu-rt-runtime[=0]] [--cpuset-cpus[=CPUSET-CPUS]]
14 [--cpuset-mems[=CPUSET-MEMS]] [--help]
15 [--kernel-memory[=KERNEL-MEMORY]] [-m|--memory[=MEMORY]]
16 [--memory-reservation[=MEMORY-RESERVATION]]
17 [--memory-swap[=MEMORY-SWAP]] [--restart[=""]] CONTAINER [CONTAINER...]
18
19
20
22 The docker update command dynamically updates container configuration.
23 You can use this command to prevent containers from consuming too many
24 resources from their Docker host. With a single command, you can place
25 limits on a single container or on many. To specify more than one
26 container, provide space-separated list of container names or IDs.
27
28
29 With the exception of the --kernel-memory option, you can specify these
30 options on a running or a stopped container. On kernel version older
31 than 4.6, You can only update --kernel-memory on a stopped container or
32 on a running container with kernel memory initialized.
33
34
35
37 --blkio-weight=0
38 Block IO weight (relative weight) accepts a weight value between 10
39 and 1000.
40
41
42 --cpu-shares=0
43 CPU shares (relative weight)
44
45
46 --cpu-period=0
47 Limit the CPU CFS (Completely Fair Scheduler) period
48
49
50 Limit the container's CPU usage. This flag tell the kernel to restrict
51 the container's CPU usage to the period you specify.
52
53
54 --cpu-quota=0
55 Limit the CPU CFS (Completely Fair Scheduler) quota
56
57
58 --cpu-rt-period=0
59 Limit the CPU real-time period in microseconds
60
61
62 Limit the container's Real Time CPU usage. This flag tell the kernel to
63 restrict the container's Real Time CPU usage to the period you specify.
64
65
66 --cpu-rt-runtime=0
67 Limit the CPU real-time runtime in microseconds
68
69
70 Limit the containers Real Time CPU usage. This flag tells the kernel to
71 limit the amount of time in a given CPU period Real Time tasks may
72 consume. Ex:
73 Period of 1,000,000us and Runtime of 950,000us means that this
74 container could consume 95% of available CPU and leave the remaining 5%
75 to normal priority tasks.
76
77
78 The sum of all runtimes across containers cannot exceed the amount
79 allotted to the parent cgroup.
80
81
82 --cpuset-cpus=""
83 CPUs in which to allow execution (0-3, 0,1)
84
85
86 --cpuset-mems=""
87 Memory nodes(MEMs) in which to allow execution (0-3, 0,1). Only
88 effective on NUMA systems.
89
90
91 --help
92 Print usage statement
93
94
95 --kernel-memory=""
96 Kernel memory limit (format: <number>[<unit>], where unit = b, k, m
97 or g)
98
99
100 Note that on kernel version older than 4.6, you can not update kernel
101 memory on
102 a running container if the container is started without kernel
103 memory initialized,
104 in this case, it can only be updated after it's stopped. The new
105 setting takes
106 effect when the container is started.
107
108
109 -m, --memory=""
110 Memory limit (format: <number><optional unit>, where unit = b, k, m
111 or g)
112
113
114 Note that the memory should be smaller than the already set swap memory
115 limit.
116 If you want update a memory limit bigger than the already set swap
117 memory limit,
118 you should update swap memory limit at the same time. If you don't
119 set swap memory
120 limit on docker create/run but only memory limit, the swap memory is
121 double
122 the memory limit.
123
124
125 --memory-reservation=""
126 Memory soft limit (format: <number>[<unit>], where unit = b, k, m or
127 g)
128
129
130 --memory-swap=""
131 Total memory limit (memory + swap)
132
133
134 --restart=""
135 Restart policy to apply when a container exits (no,
136 on-failure[:max-retry], always, unless-stopped).
137
138
139
141 The following sections illustrate ways to use this command.
142
143
144 Update a container's cpu-shares
145 To limit a container's cpu-shares to 512, first identify the container
146 name or ID. You can use docker ps to find these values. You can also
147 use the ID returned from the docker run command. Then, do the
148 following:
149
150
151 $ docker update --cpu-shares 512 abebf7571666
152
153
154
155 Update a container with cpu-shares and memory
156 To update multiple resource configurations for multiple containers:
157
158
159 $ docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse
160
161
162
163 Update a container's kernel memory constraints
164 You can update a container's kernel memory limit using the
165 --kernel-memory option. On kernel version older than 4.6, this option
166 can be updated on a running container only if the container was started
167 with --kernel-memory. If the container was started without
168 --kernel-memory you need to stop the container before updating kernel
169 memory.
170
171
172 For example, if you started a container with this command:
173
174
175 $ docker run -dit --name test --kernel-memory 50M ubuntu bash
176
177
178
179 You can update kernel memory while the container is running:
180
181
182 $ docker update --kernel-memory 80M test
183
184
185
186 If you started a container without kernel memory initialized:
187
188
189 $ docker run -dit --name test2 --memory 300M ubuntu bash
190
191
192
193 Update kernel memory of running container test2 will fail. You need to
194 stop the container before updating the --kernel-memory setting. The
195 next time you start it, the container uses the new value.
196
197
198 Kernel version newer than (include) 4.6 does not have this limitation,
199 you can use --kernel-memory the same way as other options.
200
201
202 Update a container's restart policy
203 You can change a container's restart policy on a running container. The
204 new restart policy takes effect instantly after you run docker update
205 on a container.
206
207
208 To update restart policy for one or more containers:
209
210
211 $ docker update --restart=on-failure:3 abebf7571666 hopeful_morse
212
213
214
215 Note that if the container is started with "--rm" flag, you cannot
216 update the restart policy for it. The AutoRemove and RestartPolicy are
217 mutually exclusive for the container.
218
219
220
221Docker Community Docker User Manuals DOCKER(1)