app
app copied to clipboard
[Feature Request] Lists and hash substitutions from settings.yml render
Description
When rendering it would be useful to specify more complex substitutions from settings.yml rather than being restricted to only single items.
For instance, I should be able to specify a list of volumes in settings perhaps like so:
myvols:
- /tmp:/tmp
- avol:/amount
and in my docker-compose.yml template refer to this:
services:
atest:
image: ${image}
command: 'echo "test"'
volumes: ${myvols}
Steps to reproduce the issue:
- Specify a list in settings.yml
- Attempt to refer to the list in docker-compose.yml
- docker-app render
Describe the results you received:
Error: failed to load Compose file: invalid interpolation format for services.atest.volumes: "required variable myvols is missing a value". You may need to escape any $ with another $.
Describe the results you expected: render completes successfully.
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version
:
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:56 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:21 2018
OS/Arch: linux/amd64
Experimental: false
Output of docker-app version
:
Version: v0.6.0
Git commit: 9f9c6680
Built: Thu Oct 4 13:30:33 2018
OS/Arch: linux/amd64
Experimental: off
Renderers: none
Output of docker info
:
Containers: 9
Running: 0
Paused: 0
Stopped: 9
Images: 3948
Server Version: 18.06.1-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 macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-134-generic
Operating System: Ubuntu 16.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.55GiB
Name: ******
ID: ZQ3P:BIEJ:D3AJ:5THN:U23Q:3ULB:CFUJ:EFI3:GUS3:HBLS:ZDEB:3C3U
Docker Root Dir: /home/dockerstuff
Debug Mode (client): false
Debug Mode (server): false
Username: ********
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Hi @mkubilus
There are some advanced templating features in the experimental build that you may want to try out. For example, you would be able to write the following docker-compose.yml
file:
version: '3.5'
services:
atest:
image: abc
command: echo test
volumes:
{{range $i, $v := .myvols}}
- {{$v}}
{{end}}
and render using the following command:
DOCKERAPP_RENDERERS=gotemplate docker-app render
Resulting in the following:
version: "3.5"
services:
atest:
command:
- echo
- test
image: abc
volumes:
- type: bind
source: /tmp
target: /tmp
- type: volume
source: avol
target: /amount
I'd love to see this feature available. Just wondering, for cases where only the values of the list (here myvols
) are rendered, why not being able to just write volumes: ${myvols}
?