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

docker-compose build image parameters --force-rm --pull
linking 2 containers through docker compose
Files created by manage.py commands not chown'd from root user
Is it possible to create an intermediate image within docker-compose?
docker-compose service listen on specified interface
Does Docker-Compose allow overwriting of ports when using extends?
Jhipster Docker-compose conflict
Build multiple images with Docker Compose?
JHipster Cassandra Docker Build
Defining project name inside docker-compose configuration
Docker-compose named mounted volume
cannot ping linked docker container service
How to do variable substitution in env_file?
How to create stack in tutum with docker-compose.yml file?
ecs-cli docker compose version
dynamic link update in docker-compose

Categories

HOME
qlikview
autohotkey
url
grizzly
macros
intellij-idea
virtual-machine
salesforce
ibm
latex
skypedeveloper
pandoc
ms-access-2010
country-codes
samsung-gear-s2
wkhtmltopdf
theory
velocity
urllib2
aspectj
oxid
watson-dialog
tmux
cakephp-2.0
eclipse-orion
jinja2
lambda-calculus
beacon
aiml
gnu-screen
mattermost
tcpdf
screen-scraping
apdu
scalatest
angular-schema-form
dynamics-ax-2012-r3
javapns
recreate
mobile-development
foxpro
circle
minitest
geocomplete
android-databinding
origami
mixed-models
rbac
jquery-ui-slider
quartz
paperclip
confluent
noise
dynamic-linking
boost-regex
android-vectordrawable
liferay-ide
critical-section
chain
trusted-computing
scrollmagic
android-music-player
computed-properties
mongodb-3.3
patching
usps
jmap
gtkwave
gnu-sort
play-json
adempiere
properties-file
android-filterable
xml-simple
stereotype
backtrace
esri-arc-engine
fiware-health
javadb
jsonschema2pojo
xmlserializer
nsnotificationcenter
selenium-grid2
serializer
behance-api
xml-validation
zend-db-table
objectdatasource
select2-rails
mysql2
nsautoreleasepool
blotter
boost.build
big-endian
webpage-screenshot
filedialog
flexbuilder
opendir
object-tag
rollover
text-manipulation
dynamic-scope
cross-cutting-concerns
high-load

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