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, 2019 in Docker by Namik
• 1,230 points
2,089 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, 2019 by Sirajul
• 59,230 points

Related Questions In Docker

0 votes
1 answer

How to make a port available to services outside of Docker?

Hi@akhtar, By default docker containers works in a ...READ MORE

answered May 5, 2020 in Docker by MD
• 95,460 points
2,332 views
+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,220 points

edited Oct 16, 2018 by lina 34,105 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
• 10,620 points
3,506 views
+2 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
3,908 views
0 votes
2 answers
+1 vote
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP