How to revert changes to a service's configuration?

0 votes

I have created a service as shown: 

$ docker service create --name my-service -p 8080:80 nginx:alpine

This service was running with 1 replica as observed by executing 

$ docker service ls

ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
xbw728mf6q0d        my-service          replicated          1/1                 nginx:alpine        *:8080->80/tcp

Next I updated my service to use 3 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


But I want to rollback  to my single replica service. How can i revert back the changes to my service?

Jul 8 in Docker by Namik
• 1,210 points
76 views

1 answer to this question.

0 votes

In order to roll back the service to its previous version, and confirm it is running a single replica again, run the following command.

$ 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

This will Revert back the changes made to the service's configuration.

answered Jul 8 by Sirajul
• 39,540 points

Related Questions In Docker

+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,110 points

edited Oct 16, 2018 by lina 5,423 views
0 votes
1 answer
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 9,870 points
414 views
0 votes
2 answers

How to execute docker exec commande inside a docker container ?

You need to get inside the container ...READ MORE

answered Aug 13 in Docker by Sirajul
• 39,540 points
383 views
0 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
1,057 views
0 votes
2 answers