Docker:使用RUN命令设置ENV变量的值? [英] Docker: Set value of ENV variable using RUN command?
本文介绍了Docker:使用RUN命令设置ENV变量的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
$ c> docker run -e VAR = value -e ANOTHER_VAR = another_value ... 。 VAR和ANOTHER_VAR将在容器的环境中使用。
I'm writing a Dockerfile to set up my customized WordPress environment. I'm starting with ubuntu:latest and would like to add some repositories dynamically, by setting an ENV variable to the codename of the current Ubuntu version. How can I do this, or is there a better way to achieve this?
解决方案
Start your container like this: docker run -e VAR=value -e ANOTHER_VAR=another_value ...
. VAR and ANOTHER_VAR will be available in the container's environment.
这篇关于Docker:使用RUN命令设置ENV变量的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文