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

Option to use environment variables for settings #360

Open kinghuang opened 6 years ago

kinghuang commented 6 years ago

Description

Docker Compose uses environment variables for variable substitution in Compose files. I leverage this heavily in GitLab CI pipelines to "render" Compose files (using docker-compose config). CI variables are passed to jobs as environment variables, and the Compose files in my repositories use these in various ways.

Is it possible to introduce an option to docker-app render and docker-app deploy to use environment variables as a source for settings?

Steps to reproduce the issue:

  1. Create a Docker App with a variable such as $PWD.
  2. If necessary, ensure the variable is defined in the environment.
  3. Render the app with docker-app render.

Describe the results you received:

The rendered app does not contain the value of $PWD from the environment.

Describe the results you expected:

I would like an option to tell Docker App to use environment variables as settings.

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

Output of docker version:

Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:05:26 2018
 OS/Arch:           darwin/amd64
 Experimental:      true

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:13:46 2018
  OS/Arch:          linux/amd64
  Experimental:     true

Output of docker-app version:

Version:      v0.4.1
Git commit:   48c0769c
Built:        Wed Aug 22 12:01:46 2018
OS/Arch:      darwin/amd64
Experimental: off
Renderers:    none

Output of docker info:

Containers: 41
 Running: 6
 Paused: 0
 Stopped: 35
Images: 254
Server Version: 18.06.0-ce
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 logentries splunk syslog
Swarm: active
 NodeID: w97q3z0azzcv970g3e5hn9ski
 Is Manager: true
 ClusterID: o1cdcrn2etmq3kcz2aapse3n4
 Managers: 1
 Nodes: 1
 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: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.786GiB
Name: linuxkit-025000000001
ID: PJTX:MLTV:L2TJ:ISDE:ELPG:7QKG:G7HL:D34G:5ERF:SUIX:63WT:6WOR
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 102
 Goroutines: 268
 System Time: 2018-08-24T21:33:11.1974788Z
 EventsListeners: 6
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

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

Docker for Mac 18.06.0-ce-mac69 on macOS 10.13.6.

garethr commented 6 years ago

You could do this explicitly with set.

ie. docker-app render --set PWD=$PWD

One of the things we're experimenting with here is making that interface very explicit. Though better support for this pattern might be nice.