docker / docker/cli

Stack Deploy does not merge extension fields

Open
#2,772 0 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/stack kind/enhancement version/19.03
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Docker compose and stack deploy support extension fields, the ability to partially override extension fields, and the ability to pass multiple stack files.
Taken together, these features imply a useful behaviour that does not in fact work.

Steps to reproduce the issue:

  1. Create two yml files:

base-compose.yml

version: "3.8"

x-defaults:
  logging:
    options:
      max-size: 1m

test-compose.yml

version: "3.8"

x-defaults: &defaults
  logging:   

services:
  test:
    <:: *defaults
    image: hello-world
  1. Try to deploy the stack

docker stack deploy -c base-compose.yml -c test-compose.yml test

Describe the results you received:

Without the dummy logging value the stack would not deploy at all.

yaml: map merge requires map or sequence of maps as the value

With the addition of the logging dummy the stack deploys, but docker service inspect test_test shows that the max-size option has not been applied.

Describe the results you expected:

I expected the deployed service to inherit the defaults specified in the x-defaults section.

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

Output of docker version:

Client: Docker Engine - Community
 Cloud integration  0.1.18
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 16:58:31 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:24:18 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 27
  Running: 15
  Paused: 0
  Stopped: 12
 Images: 33
 Server Version: 19.03.5
 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 ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: n44h9ubgs7r7i09z97nwd09iv
  Is Manager: true
  ClusterID: 7rcpc2tmbrgqn58me57ruoazy
  Managers: 3
  Nodes: 12
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  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: 10.1.7.90
  Manager Addresses:
   10.1.7.104:2377
   10.1.7.116:2377
   10.1.7.90:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1062.12.1.el7.x86_64
 Operating System: Red Hat Enterprise Linux Server 7.7 (Maipo)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.62GiB
 Name: lab717
 ID: JZ3A:GO4W:O2F5:KBTP:YLMM:4ZTJ:XVDD:K45J:KSJX:I6JY:WCAC:VNH2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http://10.1.254.254:9090
 HTTPS Proxy: http://10.1.254.254:9090
 No Proxy: localhost,127.0.0.1,10.1.0.0/12,.mgsops.net
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker-hub-proxy.unreal.mgsops.net/
 Live Restore Enabled: false

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

VMware ESXi

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker stack deploy command and reproduce the issue with base-compose.yml and test-compose.yml using the two -c options shown. Trace how extension fields are merged across files, then verify with docker service inspect that the deployed service includes the max-size logging option.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.