New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template variables not parsed in docker-compose.yml with docker swarm on docker v17.05.0-ce #33364
Comments
This is expected; not all options accept a template. From the section in the documentation you referred to ; Create services using templatesYou can use templates for some flags of The supported flags are the following :
So the I'll close this issue, because it's not a bug, but feel free to comment after I closed 👍 |
I don't agree with closing this ticket... If the template variables are usable in docker service create it should also be valid inside of a docker-compose.yml and docker stack deploy -c docker-compose.yml since it is just a wrapper around docker create service. Reopen this ticket please. |
@gdeverlant your docker-compose file uses a template in the command. See the linked documentation; it is not supported in |
It should be because some services need numbers incremented automatically with the name of each node. This is a use case where DB clustering systems have to statically name each node's name and so on. |
Any feedback ????? |
As mentioned, it's not currently supported; having said that, have you considered using |
I don't know how this is working with the command and template variable ... Does your solution work for each node with its dynamic template variable value ? Do you have any example so that I can try ? |
You can template an environment-variable and use that, e.g.; docker service create \
--env "SERVICE_NAME={{.Service.Name}}" \
--name helloworld \
alpine /bin/sh -c 'echo $SERVICE_NAME' Or in your case probably this will work (untested); docker service create \
--name=coordinator \
--env "SERVICE_NAME={{.Service.Name}}" \
arangodb/arangodb /bin/sh -c 'arangod --server.authentication=false --server.endpoint tcp://0.0.0.0:8529 --cluster.my-address tcp://${SERVICE_NAME}:8529 --cluster.my-local-info ${SERVICE_NAME} --cluster.my-role COORDINATOR --cluster.agency-endpoint tcp://agency:8529 --log.file /var/log/arangodb3/arangod.log' |
Description
It seems also that the templates are not working in docker stack deploy and docker-compose.yml
https://github.com/moby/moby/blob/master/docs/reference/commandline/service_create.md#create-services-using-templates
Found this bug while finding #33338
Steps to reproduce the issue:
Describe the results you received:
This is the error log of the servers :
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker version
:Manager host
Output of
docker info
:Manager host
Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: