Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack deploy with volume overriding fails #1981

Closed
LaurentTrk opened this issue Jul 4, 2019 · 7 comments · Fixed by #3304
Closed

Stack deploy with volume overriding fails #1981

LaurentTrk opened this issue Jul 4, 2019 · 7 comments · Fixed by #3304

Comments

@LaurentTrk
Copy link

LaurentTrk commented Jul 4, 2019

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.):

@LaurentTrk
Copy link
Author

Seems to be related to this opened issue on Mergo.

@cadavre
Copy link

cadavre commented Oct 4, 2019

Also looking forward to have this fixed. Cannot merge Stack-compose file over docker-compose one.

@darccio
Copy link

darccio commented Mar 24, 2020

@cadavre @LaurentTrk I just merged the PR and released version 0.3.9. I hope it fixes this.

@thaJeztah
Copy link
Member

thaJeztah commented Jul 30, 2020

I see the upstream fix was reverted in v0.3.10, because it caused regressions https://github.com/imdario/mergo/releases/tag/v0.3.10

After the broken 0.3.9, I decided to revert the faulty PR 105, reopening the issues 90 and 103. Also, this release includes all the other pending bugs. As it is getting harder to modify the codebase, I decided to freeze it. I'm going to merge only PRs fixing bugs with proper tests.

On the other hand, I will start a new cleanroom implementation. Existing tests will be reviewed and used as "test subjects". Also, I plan to collect real-world examples to use them also as "test subjects" in a separate repository.

In this process, I would like to work from the bottom to the top, focusing on getting the core right. I plan to keep a legacy compatibility layer, but the new API may differ from the current one to allow better maintenance and new features.

@darccio
Copy link

darccio commented Jul 30, 2020

Yes, sorry for that. I'll use this issue to try to find a different fix.

@thaJeztah
Copy link
Member

No worries, thanks!

@juanluisbaptiste
Copy link

Hi,

What's the status of this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants