ENV
instruction is used to set the environment variable to the value. This is in key-value format. Environment variables set using the ENV
instructions can be used in other instructions later.
ENV <variable(key)>=<value>
Also, you can use multiple <key>=<value> … variables to be set at once.
ENV <key1>=<value1> <key2>=<value2> ...
ENV MY_NAME="Sagar Budhathoki"
ENV FRIEND1=Saroj\\ Shrestha
ENV FRIEND2=Jiwan
OR
ENV MY_NAME="Sagar Budhathoki" FRIEND1=Saroj\\ Shrestha \\
FRIEND2=Jiwan
Both will result the same.
ENV
instruction can be used by omitting the =
, But it doesn’t allow to take multiple variables to be set in a single ENV
.
ENV VAR1 VALUE1
But, the following will result variable VAR1
with value “VALUE1= VAR2=VALUE2
”:
ENV VAR1 VALUE1= VAR2=VALUE2