Skip to content

Stack deploy with volume overriding fails #1981

@LaurentTrk

Description

@LaurentTrk

Description

We are trying to deploy a stack with 2 docker-compose file, the second one overriding volume settings.
The stack deploy command fails with a reflect.Value.Set using unaddressable value error.

Steps to reproduce the issue:

  1. Create docker-compose.yml file with the following content:
version: '3.4'
volumes:
  app:
services:
  bash:
    image: bash
    command: cat docker-compose.override.yml
    volumes:
      - app:/app
    working_dir: /app
  1. Create docker-compose.override.yml file with the following content:
version: '3.4'
volumes:
  app:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: $PWD
  1. Deploy a stack with the following command:
docker stack deploy --compose-file docker-compose.yml --compose-file docker-compose.override.yml test

Describe the results you received:
The command fails with :

panic: reflect: reflect.Value.Set using unaddressable value

goroutine 1 [running]:
reflect.flag.mustBeAssignable(0x95)
        /usr/local/go/src/reflect/value.go:234 +0x15e
reflect.Value.Set(0x5623e2feee80, 0xc4200bd150, 0x95, 0x5623e2feee80, 0xc420815b30, 0x15)
        /usr/local/go/src/reflect/value.go:1367 +0x31
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e2feee80, 0xc4200bd150, 0x95, 0x5623e2feee80, 0xc4200bd100, 0x95, 0xc42067f5a8, 0x2, 0xc4202adca0, 0x0, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:83 +0xe92
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e3162600, 0xc4200bd130, 0x99, 0x5623e3162600, 0xc4200bd0e0, 0x99, 0xc42067f5a8, 0x1, 0xc4202adca0, 0x0, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:72 +0x1bf6
github.com/docker/cli/vendor/github.com/imdario/mergo.deepMerge(0x5623e2fea020, 0xc42046d220, 0x195, 0x5623e2fea020, 0xc42046d228, 0x195, 0xc42067f5a8, 0x0, 0xc4202adca0, 0x195, ...)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/merge.go:115 +0x6ee
github.com/docker/cli/vendor/github.com/imdario/mergo._map(0x5623e2f12a80, 0xc42046d220, 0x5623e2f12a80, 0xc42046d228, 0xc42067f7a8, 0x1, 0x1, 0x1, 0xc42046d228)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/map.go:159 +0x38d
github.com/docker/cli/vendor/github.com/imdario/mergo.Map(0x5623e2f12a80, 0xc42046d220, 0x5623e2f12a80, 0xc42046d228, 0xc42067f7a8, 0x1, 0x1, 0x1, 0xc4203285f8)
        /go/src/github.com/docker/cli/vendor/github.com/imdario/mergo/map.go:132 +0x73
github.com/docker/cli/cli/compose/loader.mergeVolumes(0xc42047b3e0, 0xc420815500, 0x1, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/compose/loader/merge.go:216 +0xd3
github.com/docker/cli/cli/compose/loader.merge(0xc420827640, 0x2, 0x2, 0x1, 0x2, 0xc420827640)
        /go/src/github.com/docker/cli/cli/compose/loader/merge.go:31 +0x14f
github.com/docker/cli/cli/compose/loader.Load(0xc42032872b, 0x3, 0xc420042080, 0x28, 0xc4205a0540, 0x2, 0x2, 0xc4205a0570, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/compose/loader/loader.go:111 +0x661
github.com/docker/cli/cli/command/stack/loader.LoadComposefile(0x5623e329a820, 0xc42039bb00, 0x0, 0x0, 0xc4202aca80, 0x2, 0x2, 0x7ffc5e25c0b7, 0x4, 0x5623e2839243, ...)
        /go/src/github.com/docker/cli/cli/command/stack/loader/loader.go:28 +0x18e
github.com/docker/cli/cli/command/stack.newDeployCommand.func1(0xc4204c3b80, 0xc4205005f0, 0x1, 0x5, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/stack/deploy.go:49 +0x23d
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc4204c3b80, 0xc42003a0b0, 0x5, 0x5, 0xc4204c3b80, 0xc42003a0b0)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x46a
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4200eca00, 0xc420503fa0, 0x5623e2f546c0, 0xc420503fb0)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x30c
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4200eca00, 0xc4200eca00, 0x5623e325b760)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800 +0x2d
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:180 +0xde

Describe the results you expected:
The test stack should be deployed correctly.

Additional information you deem important (e.g. issue happens only occasionally):
This issue seems related to #983 and #972 .

Output of docker version:

Client:
 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77156
 Built:             Sat May  4 02:34:58 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 02:02:43 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 258
Server Version: 18.09.6
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: 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 local logentries splunk syslog
Swarm: active
 NodeID: xxxx
 Is Manager: true
 ClusterID: xxxx
 Managers: 1
 Nodes: 1
 Default Address Pool: 10.0.0.0/8  
 SubnetSize: 24
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 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.60.134
 Manager Addresses:
  192.168.60.134:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-957.12.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 7.62GiB
Name: centos-xxxx
ID: xxxx
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: laurenttrk
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

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

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