Merging
Merging & Overrides
When a container starts, Lawn merges the template compose file with the instance override to produce the final configuration. The template defines the baseline. The instance override stores the user's customizations.
By default, maps (like environment) are merged key by key. The instance override's values take precedence. Lists (like volumes) are replaced entirely if present in the override.
Removing a Variable
Set a variable to null in the override to remove it from the merged result:
services:
app:
environment:
UNWANTED_VAR: null
Replacing Entire Values
Use the !override YAML tag to replace a value entirely instead of merging:
services:
app:
ports: !override
- "9090:8080"
Use the !reset tag to remove a value entirely (the property becomes absent, rather than empty):
services:
app:
volumes: !reset
Variable Resolution
Template variables declared in x-lawn.variables are resolved at install time. The values are stored in the instance override and substituted into environment variables at container start using ${VAR:-default} syntax.
What Users Can Override
Through the Lawn UI or CLI, users can customize:
| Setting | How it's stored |
|---|---|
| Environment variables | services.<name>.environment entries |
| Port mappings | services.<name>.ports entries |
| Memory limits | services.<name>.deploy.resources.limits.memory |
| Instance name | x-lawn.instance.name |
| Auto-start | x-lawn.instance.autoStart |
| Dismissed notices | x-lawn.instance.dismissedNoticeIds |