File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
docs/reference/commandline Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,51 @@ $ docker service update --mount-rm /somewhere myservice
154154myservice
155155```
156156
157+ ### Rolling back to the previous version of a service
158+
159+ Use the ` --rollback ` option to roll back to the previous version of the service.
160+
161+ This will revert the service to the configuration that was in place before the most recent ` docker service update ` command.
162+
163+ The following example updates the number of replicas for the service from 4 to 5, and then rolls back to the previous configuration.
164+
165+ ``` bash
166+ $ docker service update --replicas=5 web
167+
168+ web
169+
170+ $ docker service ls
171+
172+ ID NAME MODE REPLICAS IMAGE
173+ 80bvrzp6vxf3 web replicated 0/5 nginx:alpine
174+
175+ ```
176+ Roll back the ` web ` service...
177+
178+ ``` bash
179+ $ docker service update --rollback web
180+
181+ web
182+
183+ $ docker service ls
184+
185+ ID NAME MODE REPLICAS IMAGE
186+ 80bvrzp6vxf3 web replicated 0/4 nginx:alpine
187+
188+ ```
189+
190+ Other options can be combined with ` --rollback ` as well, for example, ` --update-delay 0s ` to execute the rollback without a delay between tasks:
191+
192+ ``` bash
193+ $ docker service update \
194+ --rollback \
195+ --update-delay 0s
196+ web
197+
198+ web
199+
200+ ```
201+
157202### Add or remove secrets
158203
159204Use the ` --secret-add ` or ` --secret-rm ` options add or remove a service's
You can’t perform that action at this time.
0 commit comments