I tried this, but i wonder its not recognizing {{.Node.ID}} in the below command and xxenv_var is always null
docker service create --name xxservice -e xxenv_var=$(docker node ls|grep {{.Node.ID}}|awk ‘{print $2}’)
xxenv_var={{.Node.ID}} works perfectly, but having {{.Node.ID}} inside the command is not working.
Thanks.