Double Star Environment Variables in Dockerfile

I noticed that in some Docker files environment variables are set using certain expressions that perform some kind of variable substitution, for example:

ENV PASSWORD **Random** ENV NAME **False** 

I cannot find a link to these expressions in the official Docker documentation.

Where can I find a list of possible expressions that can be used in a Docker file and what is their meaning?

+5
source share
1 answer

It is an unofficial agreement to use these variables as template variables. They will be replaced at runtime.

Or you can replace them using the -e docker run switch.

For instance:

 ENV MYSQL_USER admin ENV MYSQL_PASS **Random** # Replication ENV ENV REPLICATION_MASTER **False** ENV REPLICATION_SLAVE **False** 

If you look at the beginning of the script, you will see the following:

 if [ "$MYSQL_PASS" = "**Random**" ]; then unset MYSQL_PASS fi PASS=${MYSQL_PASS:-$(pwgen -s 12 1)} 

If the value of the variable is **Random** , replace it with a randomly generated password.

+1
source

All Articles