In short
Most Coolify deploy failures fall into one of four groups: a build error, a failed healthcheck because the app listens on the wrong port or on localhost, running out of memory (exit code 137), and 502/404 errors from the Traefik proxy. First turn on debug logs in the Deployments tab, then confirm the app listens on 0.0.0.0 and on the port in the Ports Exposes field, the domain's DNS points to the server, and the server has enough RAM.
In this guide
When a deploy fails in Coolify, the problem is almost always in one of four groups: a build error, a failed health check because the app listens on the wrong port or address, running out of memory, and 502 or 404 errors from the Traefik proxy. The fastest way to find out which one is to read it from the logs instead of guessing. This guide first shows where to find the right log, then the symptoms and the permanent fix for each type of error.
Read the right log first
Coolify has three different log sources, and each one shows a different stage:
| Log | Where | When to check it |
|---|---|---|
| Deployment log | Resource > Deployments > the deploy in question | If it stopped during the build or deploy stage |
| Container log | Resource > Logs | If the deploy finished but the app does not open or keeps restarting |
| Proxy log | The coolify-proxy container in the server terminal | For 502, 404 or SSL problems |
The default view of the deployment log hides some command output. Turn on Show Debug Logs to see the full output and read the error starting from the first error line; the last line usually shows the result, while the first error above it shows the cause.
If you have root access, these commands give you a quick diagnosis on the server (connecting to a server over SSH):
docker ps -a
docker logs --tail 100 CONTAINER_ADI
docker inspect --format '{{.State.ExitCode}} {{.State.OOMKilled}}' CONTAINER_ADI
docker logs --tail 200 coolify-proxy
free -h
df -hQuick diagnosis table
| Symptom | Likely cause | Where to look first |
|---|---|---|
| Build stops with "exit code 1" | Dependency, version or command error | The first error in the debug logs |
| Build shows "Killed" or exit code 137 | Out of memory | free -h, swap |
| "New container is not healthy" and a rollback | Healthcheck failed | Port, address, healthcheck path |
| 502 Bad Gateway in the browser | The proxy cannot reach the container | Ports Exposes, 0.0.0.0 |
| "404 page not found" in the browser | Traefik does not recognize this domain | Domains field, DNS, redeploy |
| 503 "no available server" in the browser | No healthy container | Container status and healthcheck |
| Certificate error | Let's Encrypt could not issue the certificate | DNS, port 80, proxy log |
| "no space left on device" | Disk full | docker system df |
1. Build errors
Errors during the build stage are usually about the project itself rather than Coolify. The most common ones:
- Wrong Base Directory: If the app lives in a subfolder of a monorepo, enter that folder (e.g.
/apps/web) in the Base Directory field. Otherwise Nixpacks cannot detect the project. - Wrong language or runtime version: Nixpacks picks the version automatically; if your project needs a different Node.js version, fill in the
enginesfield inpackage.jsonor set theNIXPACKS_NODE_VERSIONenvironment variable. The most predictable fix is to use your own Dockerfile. - Missing lock file:
npm cidoes not run withoutpackage-lock.json. Add the lock file to the repository. - Variables that are empty at build time: Prefixed variables such as
NEXT_PUBLIC_andVITE_are baked into the code during the build. If you do not mark them as available at build time (build variable) in Coolify, the build looks successful but the app sends requests to the wrong address. - Private repository access: A "Repository not found" or "Permission denied (publickey)" error means Coolify cannot access the repository. Check the GitHub App permissions or the deploy key.
2. Port and healthcheck mismatch
If the end of the deploy log says the new container is unhealthy and Coolify rolled back to the old version, the build succeeded; the problem is in how the app starts up. There are three possible causes:
The app listens on localhost
The proxy cannot reach an app that listens on localhost or 127.0.0.1 inside the container. The app must listen on 0.0.0.0:
# Node.js (Express)
app.listen(process.env.PORT || 3000, '0.0.0.0');
# Next.js standalone
HOSTNAME=0.0.0.0
# Vite preview
vite preview --host 0.0.0.0 --port 4173
# Python (Gunicorn)
gunicorn app:app --bind 0.0.0.0:8000The Ports Exposes field is wrong
The Ports Exposes value in Coolify must match the port the app actually listens on inside the container. If the app listens on 8080 while the field is still 3000, the proxy knocks on the wrong door. Check the port in the app's startup message in the container log. In Docker Compose resources, the same rule applies to the https://alan.com:PORT suffix in the Domains field; for details, see the deploying a Docker Compose project on Coolify guide.
The healthcheck path or tool is wrong
If you enabled the healthcheck, Coolify probes the path you defined from inside the container with curl or wget. It fails when:
- The checked path returns a 404 or a redirect to a login page. Add a simple
/healthpath that returns 200 and does not require authentication. - The image has neither
curlnorwget. This is common with minimal or distroless images; add one of the tools to the image. - The app starts later than the healthcheck's start period. Increase the start period.
To isolate the problem, you can temporarily turn off the healthcheck and deploy; if the app comes up, the problem is only in the check definition.
3. Out of memory
Symptoms: Killed or exit code 137 in the build log, JavaScript heap out of memory in Node.js projects, and OOMKilled true in the docker inspect output. When memory runs out, the Linux kernel kills the process using the most memory, which is usually the build process.
- Add swap. It is not a permanent fix, but it gets you through occasional build peaks:
sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab - Set the Node.js memory limit. Add
NODE_OPTIONS=--max-old-space-size=2048as a build variable. The value must be smaller than the free RAM on the server. - Limit concurrent builds. If several projects build at the same time, lower the number of concurrent builds to 1 in the server settings.
- Move the build off the server. Build the image in a CI environment such as GitHub Actions, push it to a registry, and define the resource in Coolify as a Docker Image. The server then only runs the ready-made image.
- Scale up. If you keep falling back on swap, the server is too small; moving up a plan is the cleanest fix.
4. Traefik 502, 404 and SSL errors
404 page not found
This plain-text response comes from Traefik and means there is no routing rule for the request's domain. Checklist:
- Is the domain entered correctly in the Domains field, with the
https://prefix? wwwand the bare domain are separate entries; did you add both?- Did you Redeploy after changing the domain? Routing rules are defined with container labels, so a change only takes effect after a redeploy.
502 Bad Gateway
Traefik found the rule but could not connect to the container. The causes are the same as the port and address problems above. Also, if the container keeps restarting (repeated startup messages in the container log), the proxy returns 502 in between. In Docker Compose projects, if you isolated services with a custom networks definition, make sure they are also attached to the network the proxy is on.
The SSL certificate is not issued
If the browser shows an invalid certificate warning and the certificate appears as Traefik's default certificate, Let's Encrypt validation failed:
- Does the domain's A record point to the server IP? If you just made the change, wait for it to propagate.
- Is port 80 open in the firewall? HTTP validation happens over this port.
- If the domain is proxied through Cloudflare, validation may be blocked; turn off the proxy temporarily for the first certificate, or set the SSL mode to Full (strict).
You can see the error details in the proxy log:
docker logs coolify-proxy 2>&1 | grep -i acme5. Disk full
Every deploy leaves behind a new image layer and build cache. If you get a "no space left on device" error, clean up unused data and enable automatic Docker cleanup in Coolify's server settings:
docker system df
docker builder prune -f
docker image prune -a -fdocker image prune -a deletes every image not used by a running container; older versions kept for rollback go too. Do not use the --volumes flag, which deletes volumes, so you do not lose database data.
After the problem is fixed
To avoid hitting the same error again, switching to Dockerfile builds, adding a /health path and documenting your build variables pay off for the long term. For Next.js-specific settings, see self-hosting a Next.js app on your own server.
Next step: prevent most errors from the start
A large share of Coolify deploy errors come from a misconfigured Docker setup, a misconfigured proxy or not enough memory. On Sunucu Atlas AI Hosting with the Coolify panel preinstalled, the panel, automatic SSL and deploys from GitHub and Docker come ready to go; with root access, you can run every diagnostic command above. If your builds stop because they run out of memory, moving to SA-AI-2 with 8 GB of RAM, or to SA-AI-3 with 6 CPUs and 12 GB of RAM if you build several heavy projects, fixes the problem at the root. If the error persists, you can open a support ticket with your deploy log.
Frequently asked questions
How do I see the full build log in Coolify?
Open the deploy in question in the resource's Deployments tab and enable Show Debug Logs. This shows the hidden command output too, so you can find the first line of the error.
The deploy looks successful but the site returns 502. Why?
It means Traefik cannot reach the container. Check that the app listens on 0.0.0.0 and that the port in the Ports Exposes field matches the port the app actually listens on.
What does exit code 137 mean in Coolify?
The process was killed by the kernel, usually because it ran out of memory. You can add swap, set a memory limit with NODE_OPTIONS, move the build to a CI environment or move to a plan with more RAM.
I added my domain but I get 404 page not found.
This response comes from Traefik. Make sure you entered the domain with the https:// prefix, added www and the bare domain separately, and redeployed after the change.
Why isn't Coolify generating an SSL certificate?
Let's Encrypt validation failed. Check that the A record points to the server IP and that port 80 is open; if you use the Cloudflare proxy, turn it off temporarily for the first certificate.