Docker: Set value of ENV variable using RUN comman

2019-06-24 17:46发布

问题:

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?

回答1:

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.



标签: ubuntu docker