-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
I noticed this while reproducing/verifying #34963.
Description
The docker service ps command does not show all instances of a service after scaling down
Steps to reproduce the issue:
This is best tested on a single-node setup;
Create a service with a --stop-grace-period and that won't shutdown immediately (here, I'm using a busybox service, which will not handle signals, so won't shutdown unless killed);
$ docker service create --stop-grace-period=30s -t --replicas=2 --name shellie busyboxVerify that both docker service ps and docker ps show that two instances are running:
$ docker service ps shellie
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
qbxyaii38cs5 shellie.1 busybox:latest moby Running Running 15 seconds ago
n1h8fg9wwd2e shellie.2 busybox:latest moby Running Running 14 seconds ago$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c0869e9c8d03 busybox:latest "sh" About a minute ago Up About a minute shellie.2.n1h8fg9wwd2ezn6refbn7mb9o
7aa6507d6e76 busybox:latest "sh" About a minute ago Up About a minute shellie.1.qbxyaii38cs5pumuuv392g3cvNow, scale down the service;
$ docker service scale shellie=1
shellie scaled to 1Check the output of docker service ps, and notice that it immediately shows there's only a single task running:
$ docker service ps shellie
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
n1h8fg9wwd2e shellie.2 busybox:latest moby Running Running 2 minutes agoHowever, checking docker ps shows that there's actually still two tasks running:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c0869e9c8d03 busybox:latest "sh" 2 minutes ago Up 2 minutes shellie.2.n1h8fg9wwd2ezn6refbn7mb9o
7aa6507d6e76 busybox:latest "sh" 2 minutes ago Up 2 minutes shellie.1.qbxyaii38cs5pumuuv392g3cvAfter 30 seconds, the second instance is killed, and only a single container shows up
Describe the results you received:
docker service ps showing a single task running
Describe the results you expected:
docker service ps showing two tasks running
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version:
Client:
Version: 17.09.0-ce-rc3
API version: 1.32
Go version: go1.8.3
Git commit: 2357fb2
Built: Thu Sep 21 02:31:18 2017
OS/Arch: darwin/amd64
Server:
Version: 17.09.0-ce-rc3
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: 2357fb2
Built: Thu Sep 21 02:36:52 2017
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 35
Running: 1
Paused: 0
Stopped: 34
Images: 715
Server Version: 17.09.0-ce-rc3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
NodeID: drfinwj2um6lv0pbprh0gzzfm
Is Manager: true
ClusterID: 1nfnet5qybgsy264nxp3of5tk
Managers: 1
Nodes: 1
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Force Rotate: 0
Autolock Managers: false
Root Rotation In Progress: false
Node Address: 192.168.65.2
Manager Addresses:
192.168.65.2:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: moby
ID: 3RWB:O2US:ECBD:52GT:6CQY:7DPT:DP3F:ZFLC:BLEV:WVRD:FILS:ZT2D
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 48
Goroutines: 182
System Time: 2017-09-25T11:53:45.497931824Z
EventsListeners: 2
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):