Rolling back service updates

When you update a service in swarm mode, the swarm stores the configuration of the previous deployment. If you find a problem with the release, you can roll back to the previous state with a single command:

> docker service update --rollback nerd-dinner_nerd-dinner-homepage
nerd-dinner_nerd-dinner-homepage

The rollback is a specialized form of service update. Instead of passing an image name for tasks to update to, the rollback flag does a rolling update to the previous image used by the service. Again, the rollback happens one task at a time, so this is a zero-downtime process. You can use this command to rollback to, no matter how you applied the update—whether you used docker stack deploy or docker service update.

Rollbacks are one of the few scenarios where you might want to use imperative commands to manage your applications instead of declarative Docker Compose files. If you find a problem with a service update, it's great to be able to roll it back to the previous state with just a single command.

Service updates retain only one prior service configuration for rollbacks. If you update from version 1 to version 2 and then to version 3, the configuration of version 1 is lost. You can roll back from version 3 to version 2—but if you roll back again from version 2, it will be to the previous version, which will take you in a circle back to version 3.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.10