This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.2.2.2.4.2. 指定构建环境变量
从模板、源 或 镜像 生成应用程序时,您可以在运行时使用 --build-env
参数将环境变量传递给构建容器:
oc new-app openshift/ruby-23-centos7 \ --build-env HTTP_PROXY=http://myproxy.net:1337/ \ --build-env GEM_HOME=~/.gem
$ oc new-app openshift/ruby-23-centos7 \
--build-env HTTP_PROXY=http://myproxy.net:1337/ \
--build-env GEM_HOME=~/.gem
这些变量可使用 --build-env-file
参数从文件中读取:
cat ruby.env HTTP_PROXY=http://myproxy.net:1337/ GEM_HOME=~/.gem oc new-app openshift/ruby-23-centos7 --build-env-file=ruby.env
$ cat ruby.env
HTTP_PROXY=http://myproxy.net:1337/
GEM_HOME=~/.gem
$ oc new-app openshift/ruby-23-centos7 --build-env-file=ruby.env
另外,也可使用 --build-env-file=-
在标准输入上给定环境变量:
cat ruby.env | oc new-app openshift/ruby-23-centos7 --build-env-file=-
$ cat ruby.env | oc new-app openshift/ruby-23-centos7 --build-env-file=-