Skip to content

swarm: needless update with --resolve-image changed #34242

@zarnovican

Description

@zarnovican

Description

Stack deploy with --resolve-image changed will update the service even if the image/tag has not changed.

The first docker stack deploy.. after tag change will update the service as expected. The next deploy will update the service again, even if the tag has not changed. Any subsequent deploy won't update the service (as expected).

Steps to reproduce the issue:

  1. create stack config test.yaml
version: "3.3"

services:

    redis:
        image: redis:3.2.8
  1. deploy stack (first deploy)
docker stack deploy -c test.yaml --resolve-image changed test
  1. deploy same config again (second deploy)
docker stack deploy -c test.yaml --resolve-image changed test

Describe the results you received:

In step 3, service redis is re-deployed.

$ docker service ps test_redis
ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE             ERROR               PORTS
s6f5clqoq9jv        test_redis.1        redis:3.2.8         ip-10-72-178-242    Running             Running 42 seconds ago
kg95b9zje4x2         \_ test_redis.1    redis:3.2.8         ip-10-72-178-242    Shutdown            Shutdown 45 seconds ago

Describe the results you expected:

Service should not re-deploy, since the tag has not changed.

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

Presumably, it is because on first deploy (and any tag change), Docker will make a lookup to registry and store image id with sha256 hash. After the second deploy, you can observe that the current image is without the sha256, while the previous spec has it..

         "Spec": {
            "Name": "test_redis",
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "redis:3.2.8",
...
        "PreviousSpec": {
            "Name": "test_redis",
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "redis:3.2.8@sha256:8eb0cd22644dc1218680db876411f45baac493ac9a0bfd391d6efdef0767ea6b",

Subsequent deploy will not make that lookup and it will asume the image is redis:3.2.8. Which will not trigger any update.

Output of docker version:

Client:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:23:31 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:19:04 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 7
 Running: 2
 Paused: 0
 Stopped: 5
Images: 3
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /mnt/docker/aufs
 Backing Filesystem: extfs
 Dirs: 47
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: p13y70uqdo83gzma54cha3aua
 Is Manager: true
 ClusterID: km78r0i9lti4ihw7y4clj6pn9
 Managers: 3
 Nodes: 3
 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
 Root Rotation In Progress: false
 Node Address: 10.73.190.96
 Manager Addresses:
  10.72.178.242:2377
  10.73.190.96:2377
  10.76.153.210:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-1020-aws
Operating System: Ubuntu 16.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 1.611GiB
Name: ip-10-73-190-96
ID: PZGW:KBDE:X3UR:U43Z:R74J:LCGE:JYQZ:SEJ2:IYYU:U2GF:O5LW:PYNQ
Docker Root Dir: /mnt/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
AWS

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/stackarea/swarmkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/17.06

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions