github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/docs/reference/commandline/service_rollback.md (about) 1 --- 2 title: "service rollback" 3 description: "The service rollback command description and usage" 4 keywords: "service, rollback" 5 --- 6 7 # service rollback 8 9 ```markdown 10 Usage: docker service rollback SERVICE 11 12 Revert changes to a service's configuration 13 14 Options: 15 -d, --detach Exit immediately instead of waiting for the service to converge (default true) 16 --help Print usage 17 -q, --quiet Suppress progress output 18 ``` 19 20 ## Description 21 22 Roll back a specified service to its previous version from the swarm. 23 24 > **Note** 25 > 26 > This is a cluster management command, and must be executed on a swarm 27 > manager node. To learn about managers and workers, refer to the 28 > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the 29 > documentation. 30 31 ## Examples 32 33 ### Roll back to the previous version of a service 34 35 Use the `docker service rollback` command to roll back to the previous version 36 of a service. After executing this command, the service is reverted to the 37 configuration that was in place before the most recent `docker service update` 38 command. 39 40 The following example creates a service with a single replica, updates the 41 service to use three replicas, and then rolls back the service to the 42 previous version, having one replica. 43 44 Create a service with a single replica: 45 46 ```bash 47 $ docker service create --name my-service -p 8080:80 nginx:alpine 48 ``` 49 50 Confirm that the service is running with a single replica: 51 52 ```bash 53 $ docker service ls 54 55 ID NAME MODE REPLICAS IMAGE PORTS 56 xbw728mf6q0d my-service replicated 1/1 nginx:alpine *:8080->80/tcp 57 ``` 58 59 Update the service to use three replicas: 60 61 ```bash 62 $ docker service update --replicas=3 my-service 63 64 $ docker service ls 65 66 ID NAME MODE REPLICAS IMAGE PORTS 67 xbw728mf6q0d my-service replicated 3/3 nginx:alpine *:8080->80/tcp 68 ``` 69 70 Now roll back the service to its previous version, and confirm it is 71 running a single replica again: 72 73 ```bash 74 $ docker service rollback my-service 75 76 $ docker service ls 77 78 ID NAME MODE REPLICAS IMAGE PORTS 79 xbw728mf6q0d my-service replicated 1/1 nginx:alpine *:8080->80/tcp 80 ``` 81 82 ## Related commands 83 84 * [service create](service_create.md) 85 * [service inspect](service_inspect.md) 86 * [service logs](service_logs.md) 87 * [service ls](service_ls.md) 88 * [service ps](service_ps.md) 89 * [service rm](service_rm.md) 90 * [service scale](service_scale.md) 91 * [service update](service_update.md)