The ENV instruction

The ENV instruction sets an environment variable in the new image. An environment variable is a key-value pair, which can be accessed by any script or application. Linux applications use the environment variables a lot for a starting configuration.

The following line forms the syntax of the ENV instruction:

ENV <key> <value> 

Here, the code terms indicate the following:

  • <key>: This is the environment variable
  • <value>: This is the value that is to be set for the environment variable

The following lines give two examples for the ENV instruction, where, in the first line, DEBUG_LVL has been set to 3 and on the second line, APACHE_LOG_DIR has been set to /var/log/apache:

ENV DEBUG_LVL 3 
ENV APACHE_LOG_DIR /var/log/apache
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset