docker-compose


How dynamic map service name to ENV var


Example:
my-server:
image: my-server:latest
ports:
- 1234:1234
proxy:
image: lb:latest
environment:
- BACKEND=${VAR}??? # must be resolve as 'my-server'
The server name can be changed to any name, but the proxy has a entry-point script where the variable will be substituted in the BACKEND to config.
You can use a .env file to define your variable. This file will be placed in the same directory as your docker-compose.yml file.
When you run docker-compose, it will read this value and use it. Using your example, your .env file would look something like this:
VAR=my-server
and, the line:
- BACKEND=${VAR}??? # must be resolve as 'my-server'
would become just:
- BACKEND=${VAR}
or
BACKEND: ${VAR}

Related Links

Networking Docker Compose
How to change the config file for Riak TS when using Docker
Django Docker-compose machine does not start web server
How should docker-compose jobs discover etcd?
docker compose adding nodes dynamically to nginx frontend
Docker Swarm - dependencies definition
docker-compose volume not mounted
Exposing sentry service in docker-compose file
Yesod and docker-compose logs in development mode
Docker compose to always deploy using latest image
JHipster - Doubts in the development using Microservices Architecture
Gogs + Drone getsockopt: connection refused
Concourse result keeps loading
Docker-compose: AttributeError: 'module' object has no attribute 'ssl'
scaling a service with docker compose
Docker Compose apparently ignores COMPOSE_FILE

Categories

HOME
oauth-2.0
algolia
abc
intellisense
stdout
azure-resource-manager
grid
css-selectors
uml-designer
richtextbox
comments
travis-ci-cli
gnuradio
yacc
google-my-business-api
angular-universal
google-search-appliance
mamp
ldap-query
eclipse-orion
bookmarklet
k-means
geography
views
orange
civicrm
conditional-formatting
pumping-lemma
struts
priority-queue
launchd
typeclass
choco
favorites
jsonapi-resources
apache-falcon
bootcamp
javax
aweber
extern
office-interop
fisheye
pexpect
taiga
python-venv
infovis
emacs24
openxava
multivalue
riemann
playframework-2.3
nservicebus6
business-catalyst
chain
google-scholar
huawei
glade
virtualenvwrapper
altova
cosign-api
instaparse
key-value-store
recurring
sprockets
nimbus
avi
audiorecord
database-administration
user-profile
treelist
jcalendar
abstract
encode
jts
personality-insights
musicbrainz
joomla3.3
fileinputstream
genome
parseexception
numerical-recipes
teamstudio-unplugged
frisby.js
system.io.packaging
fscanf
episerver-7
enquire.js
sqldatasource
nativequery
mdp
php-amqplib
xcode6.1-gm-seed
kendo-window
wordbreaker
cocotron
msbuild-task
mmo
gpl
freeimage
teamsystem
openafs
aspmenu-control
event-propagation
django-admin-tools
jqueryi-ui-buttonset
mismatch
sessiontracking
llblgen
rollover
nyromodal
activescaffold
hp-trim
asp.net-1.1

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