Process Flow - Environment variables in Compose
Start Compose file
Read environment variables section
Load variables from .env file or shell
Substitute variables in service definitions
Create containers with substituted values
Containers run with environment variables set
End
Docker Compose reads environment variables from .env or shell, substitutes them in the compose file, then creates containers with those variables set.