Skip to content

'docker service rollback' returns error code 1 #35312

Description

@renskiy

docker service rollback returns error code 1 when trying to rollback to the version with more replicas.

Docker version

$ docker version
Client:
 Version:      17.10.0-ce
 API version:  1.33
 Go version:   go1.8.3
 Git commit:   f4ffd25
 Built:        Tue Oct 17 19:04:40 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.10.0-ce
 API version:  1.33 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   f4ffd25
 Built:        Tue Oct 17 19:03:20 2017
 OS/Arch:      linux/amd64
 Experimental: false

Steps to reproduce:

  1. create service with replicas=3
$ docker service create --name my-service -p 8080:80 --replicas=3 nginx:alpine
k70yv0482uaa6rgfds39wmsex
overall progress: 3 out of 3 tasks 
1/3: running   [==================================================>] 
2/3: running   [==================================================>] 
3/3: running   [==================================================>] 
verify: Service converged
  1. update service with replicas=1
$ docker service update --replicas=1 my-service
my-service
overall progress: 1 out of 1 tasks 
1/1: running   [==================================================>] 
verify: Service converged
  1. rollback service
$ docker service rollback my-service
my-service
rollback: manually requested rollback 
overall progress: rolling back update: 1 out of 3 tasks 
1/3: new       [============================================>      ] 
2/3: new       [============================================>      ] 
3/3: running   [>                                                  ] 
service rolled back: rollback completed
  1. check return code
$ echo $?
1

After rollback I got following containers (rollback actually was successful):
Node 1

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
bd60f553543d        nginx:alpine        "nginx -g 'daemon ..."   9 minutes ago       Up 9 minutes        80/tcp              my-service.3.wf309ic4b5xqc38o1a8engnct

Node 2

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c0ec0d38990e        nginx:alpine        "nginx -g 'daemon ..."   10 minutes ago      Up 10 minutes       80/tcp              my-service.2.x74kun5duu2izbzwczt0t5rq0

Node 3

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
bd60f553543d        nginx:alpine        "nginx -g 'daemon ..."   9 minutes ago       Up 9 minutes        80/tcp              my-service.3.wf309ic4b5xqc38o1a8engnct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions