Docker Compose
Compose service env_file
Load runtime variables from one or more files, relative to the Compose model path rules. Explicit environment values take priority. Do not confuse with CLI --env-file for interpolation. Distinguish a service runtime env_file from CLI interpolation input.
Formal Syntax & Structure
docker syntaxdocker
services.SERVICE.env_fileParameters & Attributes
| Name | Type | Description |
|---|---|---|
| file | string | Reviewed environment file path |
Working Example
Example Snippetdocker
env_file: - ./worker.env