Set Environment Variables

Docker's goal is to treat containers as reusable, off-the-shelf pieces of infrastructure. Often, however, we need to tailor a container to our specific needs. We may need to enable debugging facilities, enable key configuration options, create databases, and set logins. Many development-oriented containers rely on environment variables to configure containers at runtime.

In this tutorial, we'll:

  • Set environment variables using a static value in the Compose file
  • Use an environment file to pass multiple variables at once