Revert changes to a service’s configuration
Swarm This command works with the Swarm orchestrator.
$ docker service rollback [OPTIONS] SERVICE
Refer to the options section for an overview of available OPTIONS for this command.
Roll back a specified service to its previous version from the swarm.
Note
This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the Swarm mode section in the documentation.
For example uses of this command, refer to the examples section below.
| Name, shorthand | Default | Description | 
| --detach,-d | Exit immediately instead of waiting for the service to converge | |
| --quiet,-q | Suppress progress output | 
Use the docker service rollback command to roll back to the previous version of a service. After executing this command, the service is reverted to the configuration that was in place before the most recent docker service update command.
The following example creates a service with a single replica, updates the service to use three replicas, and then rolls back the service to the previous version, having one replica.
Create a service with a single replica:
$ docker service create --name my-service -p 8080:80 nginx:alpine
Confirm that the service is running with a single replica:
$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
xbw728mf6q0d        my-service          replicated          1/1                 nginx:alpine        *:8080->80/tcp
Update the service to use three replicas:
$ docker service update --replicas=3 my-service
$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
xbw728mf6q0d        my-service          replicated          3/3                 nginx:alpine        *:8080->80/tcp
Now roll back the service to its previous version, and confirm it is running a single replica again:
$ docker service rollback my-service
$ docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
xbw728mf6q0d        my-service          replicated          1/1                 nginx:alpine        *:8080->80/tcp
| Command | Description | 
|---|---|
| docker service | Manage services | 
| Command | Description | 
| docker service create | Create a new service | 
| docker service inspect | Display detailed information on one or more services | 
| docker service logs | Fetch the logs of a service or task | 
| docker service ls | List services | 
| docker service ps | List the tasks of one or more services | 
| docker service rm | Remove one or more services | 
| docker service rollback | Revert changes to a service’s configuration | 
| docker service scale | Scale one or multiple replicated services | 
| docker service update | Update a service | 
    © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
    https://docs.docker.com/engine/reference/commandline/service_rollback/