Docker Environment Variables

Docker Environment Variables #

Best practice is to move variables out of the application code into environment variables, especially if they get changed a lot.

Set variables #

Docker images that are set up to take environment variables can be run as follows:

docker run -e <environment variable>='<value>'

Inspect Environment Variables #

To look at the environment variables for containers that are already running:

docker inspect <container name or id>