docker-compose: assign different values to the same environment variables for each container in a service -
my problem
i start few containers of same service, each different value same environment variables, @ arbitrary scale.
code
consider following docker-compose
service stanza:
bidder: image: whoever/whatever environment: - role=...
in system each bidder
container reads role
environment variable @ initialization, , initializes accordingly (mainly, fetches role
configuration specific url , registers being role-owner in service discovery system).
in production, kubernetes solves problem assigning proper env vars each container. in dev/testing, have docker-compose
assign different value role
key each container. can live consecutive ids, e.g. role-1
, role-2
, not arbitrary strings container ids.
my question
how can configure docker-compose
assign different values same environment variable different instances within same service?
Comments
Post a Comment