When you deploy https://thenewstack.io/how-to-install-docker-on-ubuntu-and-centos/, you will oftentimes have to add customized variables. Those variables could include all sorts of information, including usernames, passwords, database names, etc.

To pass variables from the.env file to the command, you use $ as in $DB_DATABASE.

You can pass the.env file variables to the docker run command using the –env-file options, like so: docker run –env-file.env mysql:latest

In that directory, create the.env file with the command: Remember, the.env file must be contained within the base directory of your project, otherwise, it won’t be picked up by the deploy command.

Related Articles