You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ${TAG} variable is not available anywhere inside compose file.
E.g.:
$ docker-compose up
WARNING: The TAG variable is not set. Defaulting to a blank string.
Pulling example (alpine:latest)...
...
But:
$ TAG=edge docker-compose up
Pulling example (alpine:edge)...
...
the $TAG is now available inside the compose file.
The outcome
It's required to always explicitly provide env variable values to be able to use them inside compose file.
It feels natural to expect that all env variables are available/resolving inside the compose file, especially those that were defined by it in the first place. Although this seems to not be the case.
Sorry if this was answered before, I didn't find this particular use-case in issues list.
Tech specs:
$ docker version
Client:
Version: 1.13.1
API version: 1.26
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 08:47:51 2017
OS/Arch: darwin/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 092cba3
Built: Wed Feb 8 08:47:51 2017
OS/Arch: linux/amd64
Experimental: true
In short, the environment entry in your compose file declares the environment variables that will be available inside your container/service at runtime. Variable substitution on the other hand is done using the variables present on the host where docker-compose is being executed. Those are two different sets and should remain separate.
The issue
Environment variables availability inside compose file provided from the following:
feels inconsistent. Environment vars with default values are not available inside compose unless explicitly provided from outside of it.
The example
Consider the following minimal compose file:
The
${TAG}
variable is not available anywhere inside compose file.E.g.:
But:
the $TAG is now available inside the compose file.
The outcome
It's required to always explicitly provide env variable values to be able to use them inside compose file.
It feels natural to expect that all env variables are available/resolving inside the compose file, especially those that were defined by it in the first place. Although this seems to not be the case.
Sorry if this was answered before, I didn't find this particular use-case in issues list.
Tech specs:
$ docker version Client: Version: 1.13.1 API version: 1.26 Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: darwin/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Go version: go1.7.5 Git commit: 092cba3 Built: Wed Feb 8 08:47:51 2017 OS/Arch: linux/amd64 Experimental: true
The text was updated successfully, but these errors were encountered: