Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Implement runRollback to not use runUpdate Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Add version tag and add flag quiet to suppress progress output Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Removed flags from warnDetachDefault Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Used command.Cli interface Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Add detach flag on rollback command Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Create a fakeClient for service commands Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Added unit test for rollback command Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Used command.Cli interface instead of *command.DockerCli in service commands Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Revert "Removed flags from warnDetachDefault" This reverts commit 3e4f601c8a82cc2599a755dc693409bbc47917fc. Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Fixed test.NewFakeCli instanciation Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Removed unused receiver Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Replaced cli by dockerCli Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Revert "Removed unused receiver" This reverts commit 604ef7c13df3d019949ca81d992db501114dafce. Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com> Fixed last typo Signed-off-by: Jimmy Leger <jimmy.leger@gmail.com>
95 lines
2.9 KiB
Markdown
95 lines
2.9 KiB
Markdown
---
|
|
title: "service rollback"
|
|
description: "The service rollback command description and usage"
|
|
keywords: "service, rollback"
|
|
---
|
|
|
|
<!-- This file is maintained within the docker/cli Github
|
|
repository at https://github.com/docker/cli/. Make all
|
|
pull requests against that repo. If you see this file in
|
|
another repository, consider it read-only there, as it will
|
|
periodically be overwritten by the definitive file. Pull
|
|
requests which include edits to this file in other repositories
|
|
will be rejected.
|
|
-->
|
|
|
|
# service rollback
|
|
|
|
```markdown
|
|
Usage: docker service rollback SERVICE
|
|
|
|
Revert changes to a service's configuration
|
|
|
|
Options:
|
|
-d, --detach Exit immediately instead of waiting for the service to converge (default true)
|
|
--help Print usage
|
|
-q, --quiet Suppress progress output
|
|
```
|
|
|
|
## Description
|
|
|
|
Roll back a specified service to its previous version from the swarm. This command must be run
|
|
targeting a manager node.
|
|
|
|
## Examples
|
|
|
|
### Roll back to the previous version of a service
|
|
|
|
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:
|
|
|
|
```bash
|
|
$ docker service create --name my-service -p 8080:80 nginx:alpine
|
|
```
|
|
|
|
Confirm that the service is running with a single replica:
|
|
|
|
```bash
|
|
$ 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:
|
|
|
|
```bash
|
|
$ 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:
|
|
|
|
```bash
|
|
$ 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
|
|
```
|
|
|
|
## Related commands
|
|
|
|
* [service create](service_create.md)
|
|
* [service inspect](service_inspect.md)
|
|
* [service logs](service_logs.md)
|
|
* [service ls](service_ls.md)
|
|
* [service ps](service_ps.md)
|
|
* [service rm](service_rm.md)
|
|
* [service scale](service_scale.md)
|
|
* [service update](service_update.md)
|