docker / docker/cli

docker service scale --detach=false does not wait for tasks to quit when scaling down

Open
#720 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/swarm version/17.09
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

docker service scale --detach=false does not wait for tasks to quit when scaling down, but instead instantly proceeds to the verify stage. When the command quits, the tasks to be stopped may still be running when they take some time to shut down.

Steps to reproduce the issue:

  1. docker service create --name test debian sh -c "while true; do sleep 15; done"
  2. docker service scale --detach=false test=0

Describe the results you received:
Command immediately prints overall progress: 0 out of 0 tasks and proceeds to verify stage, even if the service container is still running. The container sometimes still runs when the command quits.

Describe the results you expected:
The command blocks until the container is stopped.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:23 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:49 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Additional environment details (AWS, VirtualBox, physical, etc.):
RHEL 7.4 on physical server

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the docker service scale --detach=false command through its scaling and verify stages, then reproduce the issue with the provided debian service and scale it to zero. Done means the command waits until the stopped container has actually quit before completing.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.