From 34919accaa1f43fce17398aa82430cfe5883ea2f Mon Sep 17 00:00:00 2001 From: erxian Date: Wed, 15 Feb 2017 16:04:44 +0800 Subject: [PATCH] add rollback explanation to docker service update command document Signed-off-by: erxian --- docs/reference/commandline/service_update.md | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/docs/reference/commandline/service_update.md b/docs/reference/commandline/service_update.md index cd51e771d7..0a3bdd2c8a 100644 --- a/docs/reference/commandline/service_update.md +++ b/docs/reference/commandline/service_update.md @@ -154,6 +154,51 @@ $ docker service update --mount-rm /somewhere myservice myservice ``` +### Rolling back to the previous version of a service + +Use the `--rollback` option to roll back to the previous version of the service. + +This will revert the service to the configuration that was in place before the most recent `docker service update` command. + +The following example updates the number of replicas for the service from 4 to 5, and then rolls back to the previous configuration. + +```bash +$ docker service update --replicas=5 web + +web + +$ docker service ls + +ID NAME MODE REPLICAS IMAGE +80bvrzp6vxf3 web replicated 0/5 nginx:alpine + +``` +Roll back the `web` service... + +```bash +$ docker service update --rollback web + +web + +$ docker service ls + +ID NAME MODE REPLICAS IMAGE +80bvrzp6vxf3 web replicated 0/4 nginx:alpine + +``` + +Other options can be combined with `--rollback` as well, for example, `--update-delay 0s` to execute the rollback without a delay between tasks: + +```bash +$ docker service update \ + --rollback \ + --update-delay 0s + web + +web + +``` + ### Add or remove secrets Use the `--secret-add` or `--secret-rm` options add or remove a service's