Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

docker compose panics with volume override #1261

Closed
chrisbecke opened this issue Feb 9, 2021 · 1 comment · Fixed by compose-spec/compose-go#106 or #1402
Closed

docker compose panics with volume override #1261

chrisbecke opened this issue Feb 9, 2021 · 1 comment · Fixed by compose-spec/compose-go#106 or #1402
Assignees
Labels
bug: crash 💥 App crashes and is unusable in a significant way.

Comments

@chrisbecke
Copy link

chrisbecke commented Feb 9, 2021

Description

When generating compose files for local, and cloud, deployments, different volume drivers need to be specified for the different cloud contexts. Using multiple --file directives to merge compose files seems a convenient way to support this scenario, however this causes docker compose up to throw a panic trying to merge the volume sections.

Steps to reproduce the issue:

docker-compose.yml

version: "3.9"
volumes:
  data:
services:
  cloud-test:
    image: nginx:latest
    volumes:
    - data:/data
    ports:
    - 80:80

docker-compose.azure.yml

version: "3.9"
volumes:
  data:
    driver: azure_file
    driver_opts:
      share_name: test-share
      storage_account_name: my-storage-account
  1. This example requires an Azure account with a configured docker context and an azure storage account.
  2. Save the above files in a folder and open a terminal there.
  3. Execute docker --context azure compose up --file docker-compose.yml --file docker.compose.azure.yml where azure is the name of your azure context.

Describe the results you received:

panic: reflect: reflect.Value.Set using unaddressable value
goroutine 1 [running]:
reflect.flag.mustBeAssignableSlow(0x95)
        reflect/value.go:260 +0x138
reflect.flag.mustBeAssignable(...)
        reflect/value.go:247
reflect.Value.Set(0x2cc2ea0, 0xc000744b00, 0x95, 0x2cc2ea0, 0xc000743a40, 0x15)
        reflect/value.go:1558 +0x3b
github.com/imdario/mergo.deepMerge(0x2cc2ea0, 0xc000744b00, 0x95, 0x2cc2ea0, 0xc000744aa0, 0x95, 0xc00060ee60, 0x2, 0xc00074ae20, 0x0, ...)
        github.com/imdario/mergo@v0.3.11/merge.go:104 +0x1b97
github.com/imdario/mergo.deepMerge(0x2fd7060, 0xc000744ae0, 0x99, 0x2fd7060, 0xc000744a80, 0x99, 0xc00060ee60, 0x1, 0xc00074ae20, 0x0, ...)
        github.com/imdario/mergo@v0.3.11/merge.go:93 +0x2fb9
github.com/imdario/mergo.deepMerge(0x2cc0f80, 0xc00000f6c8, 0x195, 0x2cc0f80, 0xc00000f6d0, 0x195, 0xc00060ee60, 0x0, 0xc00074ae20, 0x195, ...)
        github.com/imdario/mergo@v0.3.11/merge.go:147 +0xa5b
github.com/imdario/mergo._map(0x2a42e60, 0xc00000f6c8, 0x2a42e60, 0xc00000f6d0, 0xc00060f090, 0x1, 0x1, 0x1, 0x1)
        github.com/imdario/mergo@v0.3.11/map.go:163 +0x43e
github.com/imdario/mergo.Map(...)
        github.com/imdario/mergo@v0.3.11/map.go:133
github.com/compose-spec/compose-go/loader.mergeVolumes(...)
        github.com/compose-spec/compose-go@v0.0.0-20210106202047-687be5e0e320/loader/merge.go:259
github.com/compose-spec/compose-go/loader.merge(0xc00074c730, 0x2, 0x2, 0x1, 0x2, 0xc00074c730)
        github.com/compose-spec/compose-go@v0.0.0-20210106202047-687be5e0e320/loader/merge.go:59 +0x20d
github.com/compose-spec/compose-go/loader.Load(0x0, 0x0, 0xc00029c8c0, 0x21, 0xc000509440, 0x2, 0x2, 0xc000508ea0, 0xc00000e078, 0x1, ...)
        github.com/compose-spec/compose-go@v0.0.0-20210106202047-687be5e0e320/loader/loader.go:176 +0x379
github.com/compose-spec/compose-go/cli.ProjectFromOptions(0xc0000b2f00, 0xc0000b2f00, 0x0, 0x0)
        github.com/compose-spec/compose-go@v0.0.0-20210106202047-687be5e0e320/cli/options.go:186 +0x31f
github.com/docker/compose-cli/cli/cmd/compose.setup(0x3640b80, 0xc00028ccf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00000c660, 0x2, ...)
        github.com/docker/compose-cli/cli/cmd/compose/up.go:125 +0xb4
github.com/docker/compose-cli/cli/cmd/compose.runCreateStart(0x3640b80, 0xc00028ccf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00000c660, 0x2, ...)
        github.com/docker/compose-cli/cli/cmd/compose/up.go:85 +0xad
github.com/docker/compose-cli/cli/cmd/compose.upCommand.func1(0xc0003ba580, 0xc000372500, 0x0, 0x4, 0x0, 0x0)
        github.com/docker/compose-cli/cli/cmd/compose/up.go:49 +0xf1
github.com/spf13/cobra.(*Command).execute(0xc0003ba580, 0xc0003724c0, 0x4, 0x4, 0xc0003ba580, 0xc0003724c0)
        github.com/spf13/cobra@v1.1.1/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0xc00002d080, 0xc00028ccc0, 0x2cfdf80, 0x4831bd8)
        github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.1.1/command.go:895
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        github.com/spf13/cobra@v1.1.1/command.go:888
main.main()
        github.com/docker/compose-cli/cli/main.go:203 +0xa37

Describe the results you expected:

The compose files to deploy successfully.

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

Output of docker version:

Client: Docker Engine - Community
 Cloud integration: 1.0.7
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:12:42 2020
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:15:28 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker context show:
You can also run docker context inspect context-name to give us more details but don't forget to remove sensitive content.

[
    {
        "Name": "azure",
        "Metadata": {
            "Description": "rg-docker@northeurope",
            "Type": "aci"
        },
        "Endpoints": {
            "aci": {
                "Location": "northeurope",
                "ResourceGroup": "rg-docker",
                "SubscriptionID": "REDACTED"
            },
            "docker": {
                "SkipTLSVerify": false
            }
        },
        "TLSMaterial": {},
        "Storage": {
            "MetadataPath": "/Users/chrisb/.docker/contexts/meta/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
            "TLSPath": "/Users/chrisb/.docker/contexts/tls/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
        }
    }
]

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.5.0)

Server:
 Containers: 22
  Running: 0
  Paused: 0
  Stopped: 22
 Images: 162
 Server Version: 20.10.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.121-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 7.779GiB
 Name: docker-desktop
 ID: KXAW:KOVW:XJST:6JYM:4JEB:3NVO:FNCA:SL2C:C5YW:66QU:CHXM:IJYN
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS ECS, Azure ACI, local, etc.):

Docker Desktop 3.1.0 (51484)
Azure ACI

@chris-crone chris-crone added bug: crash 💥 App crashes and is unusable in a significant way. compose labels Feb 9, 2021
@chris-crone
Copy link
Contributor

Thanks for the report @chrisbecke! We'll take a look

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: crash 💥 App crashes and is unusable in a significant way.
Projects
None yet
3 participants