DevOps Articles

Curated articles, resources, tips and trends from the DevOps World.

What Is the Docker .env File and How Do You Use It?

2 years ago thenewstack.io
What Is the Docker .env File and How Do You Use It?

Summary: This is a summary of an article originally published by The New Stack. Read the full original article here →

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.

Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com