docker service rollback
内容説明 | Revert changes to a service's configuration |
---|---|
利用方法 | docker service rollback [OPTIONS] SERVICE |
Swarm このコマンドは Swarm オーケストレーターにおいて動作します。
内容説明
Roll back a specified service to its previous version from the swarm.
メモ
これはクラスター管理コマンドであるため、Swarm のマネージャーノード上で実行する必要があります。 マネージャーノードとワーカーノードについては、本ドキュメントの Swarm モード を参照してください。
オプション
オプション | デフォルト | 内容説明 |
---|---|---|
-d, --detach | API 1.29 以上 Exit immediately instead of waiting for the service to converge | |
-q, --quiet | Suppress progress output |
利用例
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:
$ 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