1 min read 185 words Updated Sep 24, 2026 Created Sep 24, 2026
#backend#selfhosting

Manging environment variables

In the configuration for an service, the option "Environment variables" is available. There, you can put envs, necessary for production settings. Options exist for runtime only and availability at build time.

Envs, defined in Coolify, are available to Docker / Docker Compose.

Port configuration

It is recommended to not use port mapping as commonly seen in Docker Compose 3000:3000 but rather, let Coolify manage the external port. Thus, only provide as port 3000. Then, let the domain in the Coolify configuration redirect to the given port, using app.mydomain.com:3000

Important: This is only for services that should be reachable for the outside. Do not provide 3000:3000nor 3000 for a database etc. that should be reached from only within.
Simply leave out the port in this case or bind it to localhost. See:

Dealing with gateway timeouts

https://coolify.io/docs/troubleshoot/applications/gateway-timeout

One should not use custom docker networks in Coolify, as this might lead to redirecting errors due to the default proxy.

Managing the proxy

In case something breaks, one can restart the proxy manually:

cd /data/coolify/proxy
docker compose up -d