Signed-off-by: erxian <evelynhsu21@gmail.com>
| ... | ... |
@@ -154,6 +154,51 @@ $ docker service update --mount-rm /somewhere myservice |
| 154 | 154 |
myservice |
| 155 | 155 |
``` |
| 156 | 156 |
|
| 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 |
+ |
|
| 157 | 202 |
### Add or remove secrets |
| 158 | 203 |
|
| 159 | 204 |
Use the `--secret-add` or `--secret-rm` options add or remove a service's |