How to do variable substitution in env_file?

吃可爱长大的小学妹 提交于 2019-12-10 13:39:04

问题


I am using docker-compose and I want my env_file to have variable subsitution. I would like to define one variable in the file and then use it in other variables:

APP_ENV=dev-foo
LOCALPATH=/tmp/builddir/${APP_ENV}
GIT_URL=git@github.com:some-org/${APP_ENV}

What is the supported form of variable substitutions in env_file???


回答1:


Variable substitution is not supported in env_file.

Your options are:

  • use variables in the environment: section (although you wont be able to do your example because setting a value in environment only sets it for the container environment, and substitution happens on the host).
  • use host variables by specifying an environment variable without a value (ex: LOCALPATH=), which may be in either the env_file or environment section.


来源:https://stackoverflow.com/questions/35277472/how-to-do-variable-substitution-in-env-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!