Docker:使用RUN命令设置ENV变量的值? [英] Docker: Set value of ENV variable using RUN command?

查看:613
本文介绍了Docker:使用RUN命令设置ENV变量的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Docker文件来设置我自定义的WordPress环境。我从ubuntu开始:最新,并希望通过将ENV变量设置为当前Ubuntu版本的代号来动态添加一些存储库。如何做到这一点,还是有更好的方式来实现呢?

解决方案

$ 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆