Configuring containers
More often than not, we need to provide some configuration to the application running inside a container. The configuration is often used to allow the same container to run in very different environments, such as in development, test, staging, or production environments. In Linux, configuration values are often provided via environment variables.
We have learned that an application running inside a container is completely shielded from its host environment. Thus, the environment variables that we see on the host are different from the ones that we see within a container.
Let’s prove this by looking at what is defined on our host:
- Use this command to display a list of all environment variables defined for your Terminal session:
$ export
On the author’s macOS, the output is something like this (shortened):
...COLORTERM=truecolor COMMAND_MODE=unix2003 ... HOME=/Users/gabriel HOMEBREW_CELLAR=/opt/homebrew/Cellar HOMEBREW_PREFIX...