docker-compose


How to do variable substitution in env_file?


I am using docker-compose and I want my env_file to have variable subsitution. I would like to define one variable in the file and then use it in other variables:
APP_ENV=dev-foo
LOCALPATH=/tmp/builddir/${APP_ENV}
GIT_URL=git#github.com:some-org/${APP_ENV}
What is the supported form of variable substitutions in env_file???
Variable substitution is not supported in env_file.
Your options are:
use variables in the environment: section (although you wont be able to do your example because setting a value in environment only sets it for the container environment, and substitution happens on the host).
use host variables by specifying an environment variable without a value (ex: LOCALPATH=), which may be in either the env_file or environment section.

Related Links

Limit resources in docker-compose v3
Docker compose: using relative service address in environment
Azure Container Service: Update Docker-Compose?
Docker compose: doesnt allow to use constraints if you have a env variable set
How to use visual studio docker function on Windows Home edition?
Passing arguments to docker compose file when using it for swarm
How to run ad hoc docker compose commands in Ansible?
Using custom hostnames for docker local development containers
Changing the network name?
Let external container know about subnets created by multiple docker-compose projects
How to monitor / discover more docker containers with prometheus
two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
docker compose 3.1(swarm), secrets, ssl and nginx
What is the version directive for?
How to run docker-compose up -d at system start up?
In Docker Compose can I have services exiting

Categories

HOME
javafx
azure-documentdb
macros
gsm
dronekit
python-requests
salesforce-lightning
lithium
aggregation-framework
powerquery
rmarkdown
pip
activejdbc
select2
vichuploaderbundle
virtualenv
mongodb-replica-set
expo
css-float
restructuredtext
android-navigation-drawer
klipfolio
hololens
angular2-pipe
pumping-lemma
ithit-webdav-server
my.cnf
recreate
2checkout
folder
opencsv
ibm-bpm
keil
n1ql
wit-ai
azure-vm-scale-set
pygraphviz
word-wrap
quartz
amazon-fire-tv
ng-class
extjs3
visualizer
bioperl
kendo-scheduler
reloaddata
node.js-client
apache-commons-cli
blitz3d
hdr
deck.js
tinybox2
geokit
syslog4j
normalisation
django-celery
razorengine
periodic-processing
music-player
jts
page-flipping
dnvm
avrcp
eaaccessory
web-standards
system.diagnostics
screen-lock
nexusdb
conkeror
illegalargumentexception
clearcanvas
nsurlrequest
telerik-appbuilder
twitter-finagle
email-headers
object-oriented-database
db2-connect
xml-validation
surfaceview
scidb
kohana-orm
panelgrid
latex-suite
ftpwebrequest
bindinglist
virtual-printer
javah
for-xml
file-storage
unauthorized
j++

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App