Description
Recent releases of Docker Compose have support for a required environment variable substitution using the syntax ${ENV_VAR?error message if missing}. (docs here)
So, for example, I should be able to do:
environment:
- "CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL?cloudflare email}"
- "CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY?cloudflare api key}"
Indeed, docker-compose up appears to handle this correctly. However, when I attempt to use docker stack deploy I get:
invalid interpolation format for services.http.environment.[]: "CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL?cloudflare email is required}". You may need to escape any $ with another $.
Steps to reproduce the issue:
docker stack deploy with itDescribe the results you received:
The Docker CLI' stack command fails to parse the compose file.
Describe the results you expected:
The Docker CLI's stack command should behave identically to docker-compose.
Additional information you deem important (e.g. issue happens only occasionally):
N/A
Output of docker version:
Client:
Version: 18.03.1-ce
API version: 1.37
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:13:02 2018
OS/Arch: darwin/amd64
Experimental: false
Orchestrator: swarm
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:22:38 2018
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 14
Running: 0
Paused: 0
Stopped: 14
Images: 69
Server Version: 18.03.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 ipvlan 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: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.87-linuxkit-aufs
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: JQ4U:ATEE:MKJ5:NQXB:HMHL:GCNR:RYQA:E7IZ:X7S4:WHS4:TOPI:NITE
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 21
Goroutines: 39
System Time: 2018-04-29T15:16:31.63891038Z
EventsListeners: 2
HTTP Proxy: docker.for.mac.http.internal:3128
HTTPS Proxy: docker.for.mac.http.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.):
N/A
Exact same version info as OP, but I am using the required syntax for build args, which should be ignored by docker stack deploy.
invalid interpolation format for services.foo.build.args.[]: "http_proxy=${HTTP_PROXY:?HTTP_PROXY}". You may need to escape any $ with another $.
Thanks for reporting; this was implemented in https://github.com/docker/cli/pull/893, and is included in docker 18.04 and up. I opened a request for backporting this to the current stable release, but given that this is a feature/enhancement, it's not been decided yet if this will be backported.
(as a workaround, it's possible to download the 18.04 client, and use that, as stack deploy is handled by the client).
I'm closing this issue, because this is addressed in 18.04 and up, but feel free to continue the conversation.
Upgrading my client to 18.04 is fine by me, thanks!
Most helpful comment
Thanks for reporting; this was implemented in https://github.com/docker/cli/pull/893, and is included in docker 18.04 and up. I opened a request for backporting this to the current stable release, but given that this is a feature/enhancement, it's not been decided yet if this will be backported.
(as a workaround, it's possible to download the 18.04 client, and use that, as stack deploy is handled by the client).
I'm closing this issue, because this is addressed in 18.04 and up, but feel free to continue the conversation.