Configuration Options - docker/compose

Configuration options in Docker Compose allow for customization of the application model and include using environment variables and command-line arguments.

Environment variables in Docker Compose can be set in various ways, including using the COMPOSE_PROFILES environment variable to specify one or more profiles to be enabled on compose up execution. The Compose file version 2.x added the priority key to service network mappings, allowing the user to define in which order the specified service will connect to each network.

Compose files can be merged using the -f option, which allows for the use of multiple Compose files and override files. When using multiple Compose files, all paths in the files must be relative to the base Compose file.

Command-line arguments in Docker Compose include the -p flag to specify a project name, which can be set in different ways including through the COMPOSE_PROJECT_NAME environment variable or the top level name: variable in the config file.

The docker stack deploy command allows for the deployment of a Docker application on a swarm by using a Compose file. The docker compose config command renders the actual data model to be applied on the Docker engine, merging the Compose files set by -f flags, resolving variables in the Compose file, and expanding short-notation into the canonical format.

Docker Compose also supports the use of profiles, which help adjust the Compose application model for various uses and environments by selectively starting services. Services can be assigned to zero or more profiles, and if assigned, they are only started if the profile is activated.

For more information, please refer to the following resources: