Published: 2024-08-20 | Updated: 2026-09-14
It is recommended to create a .env.example file to your project with all your
environment variables.
If you want to pre-populate environment variables to show up in Coolify UI, you
can do so by defining them in docker-compose.yaml with the following syntax:
services:
myservice:
environment:
# Gets passed to the container but will not be visible in Coolify's UI
- SOME_HARDCODED_VALUE=hello
# Creates an uninitialized environment variable editable in Coolify's UI
- SOME_VARIABLE=${SOME_VARIABLE}
# Creates an environment variable of value "hello" editable in Coolify's UI
- SOME_DEFAULT_VARIABLE=${SOME_DEFAULT_VARIABLE:-hello}
See Coolify Docs on defining environment variables for more info.
.env.example file to Production section[!WARNING]
Do NOT set Interpolation to “Literal” as it silently adds
'characters to the variables. You should avoid using special characters in values and stick to alphanumeric if possible because Coolify has a habit of messing up values with special characters.
Set Build -> Build arguments to Managed manually in Dockerfile in advanced
settings. ARGs should always be manually defined in Dockerfile. Then just add
them to docker-compose.yaml.
# docker-compose.yml
services:
app:
build:
dockerfile: Dockerfile
args:
MY_BUILD_ARG: ${MY_BUILD_ARG} All content © Kimmo Salmela — Source on GitHub