docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 177 forks source link

Parameters with dots not always applied correctly on install #555

Closed kinghuang closed 5 years ago

kinghuang commented 5 years ago

Description

If a parameter name has dots in it, the parameter values are resolved correctly when rendered, but not always when the app is installed.

Steps to reproduce the issue:

Given the following app and parameter files.

dots.dockerapp

name: dots
version: 0.1.0
description: Dots in parameter names.
maintainers:
  - name: king.huang
    email: king.huang@oildex.com

---
version: "3.7"
services:
  nginx:
    image: nginx:latest
    environment:
      SOME_ENV: ${configs.a.b.c}
      ANOTHER_ENV: ${configs.d}

---
configs:
  a.b.c: 1111
  d: AAAA

params.yml

configs:
  a.b.c: 9999
  d: ZZZZ

1) Render the app with the parameters file. 2) Install the app with the parameters file. 3) Inspect the installed service's environment variables spec.

Describe the results you received:

Running docker app render with the parameters file shows SOME_ENV with the value 9999.

$ docker app render dots --parameters-file params.yml
version: "3.7"
services:
  nginx:
    environment:
      ANOTHER_ENV: ZZZZ
      SOME_ENV: "9999"
    image: nginx:latest

But, when installed, the configs.a.b.c value from the parameters file is not always applied. SOME_ENV sometimes has the value 1111 from the app's default parameters, and sometimes has the value 9999 from the parameters file. The other parameter (configs.d) is always substituted correctly.

Bad install:

$ docker app install dots --parameters-file params.yml
Creating network dots_default
Creating service dots_nginx
Application "dots" installed on context "default"
$ docker service inspect dots_nginx --format '{{ .Spec.TaskTemplate.ContainerSpec.Env }}'
[ANOTHER_ENV=ZZZZ SOME_ENV=1111]

Good install:

$ docker app install dots --parameters-file params.yml
Creating network dots_default
Creating service dots_nginx
Application "dots" installed on context "default"
$ docker service inspect dots_nginx --format '{{ .Spec.TaskTemplate.ContainerSpec.Env }}'
[ANOTHER_ENV=ZZZZ SOME_ENV=9999]

Describe the results you expected:

SOME_ENV should always have the value 9999 instead of 1111, in this example.

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

The bad substitution doesn't always happen. Seems random to me, whether it will work or not.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.0-rc2
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        f97efcc
 Built:             Wed Jun  5 01:37:53 2019
 OS/Arch:           darwin/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.0-rc2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       f97efcc
  Built:            Wed Jun  5 01:42:10 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker app version:

Version:               v0.8.0-rc1
Git commit:            73d86744
Built:                 Wed Jun  5 01:45:27 2019
OS/Arch:               darwin/amd64
Experimental:          off
Renderers:             none
Invocation Base Image: docker/cnab-app-base:v0.8.0-rc1

Output of docker info:

Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0-rc1)
  buildx: Build with BuildKit (Docker Inc., v0.2.2-tp-docker)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 296
 Server Version: 19.03.0-rc2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  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: ilntgb4sbycucyl3iiva1wk3p
  Is Manager: true
  ClusterID: wsz99afbhy169obu69h1eq7z0
  Managers: 1
  Nodes: 1
  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: 192.168.65.3
  Manager Addresses:
   192.168.65.3:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.125-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 11.71GiB
 Name: docker-desktop
 ID: b5307ed3-4dc8-4eb4-b931-138544ef581f
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 48
  Goroutines: 168
  System Time: 2019-06-17T22:49:14.488594Z
  EventsListeners: 2
 HTTP Proxy: gateway.docker.internal:3128
 HTTPS Proxy: gateway.docker.internal:3129
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

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

kinghuang commented 5 years ago

Maybe related to #549?

rumpl commented 5 years ago

@kinghuang thanks for reporting this. Indeed this is the same bug as #549, it's fixed now.