I was wondering if there is a way to use environment variables taken from the host where the container is deployed, instead of the ones taken from where the docker stack d
docker stack d
It works if you run the docker command through env.
env JMX_HOSTNAME="${JMX_HOSTNAME}" docker stack deploy -c docker-compose.yml mystack
Credit to GitHub issue that pointed me in the right direction.