V
V
Vitaly Arkhipov2019-10-18 17:11:52
Docker
Vitaly Arkhipov, 2019-10-18 17:11:52

How to set a specific environment variable for each node in docker swarm?

For the docker service create command , you can use templates for the --env field, but the Labels variable for Node is not available there, for example:

docker service create --env SOME_ENV="{{.Node.Labels.SOME_NODE_LABEL_VALUE}}"

Maybe there is some correct way for this, ie. for each node, set labels in advance, and then use them when starting the task in docker swarm.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2019-10-19
@chupasaurus

Docker Swarm does not have this functionality.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question