Host environment variables with docker stack deploy

后端 未结 2 1866
無奈伤痛
無奈伤痛 2021-02-06 02:55

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

2条回答
  •  盖世英雄少女心
    2021-02-06 03:45

    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.

提交回复
热议问题