EN · $ USD
Developer and Application Servers

Coolify Deploy Failed: Fixing Build and Container Errors

7 min read Updated: Sunucu Atlas technical team

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
  1. Read the right log first
  2. Quick diagnosis table
  3. 1. Build errors
  4. 2. Port and healthcheck mismatch
  5. 3. Out of memory
  6. 4. Traefik 502, 404 and SSL errors
  7. 5. Disk full
  8. After the problem is fixed
  9. Next step: prevent most errors from the start

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:

LogWhereWhen to check it
Deployment logResource > Deployments > the deploy in questionIf it stopped during the build or deploy stage
Container logResource > LogsIf the deploy finished but the app does not open or keeps restarting
Proxy logThe coolify-proxy container in the server terminalFor 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 -h

Quick diagnosis table

SymptomLikely causeWhere to look first
Build stops with "exit code 1"Dependency, version or command errorThe first error in the debug logs
Build shows "Killed" or exit code 137Out of memoryfree -h, swap
"New container is not healthy" and a rollbackHealthcheck failedPort, address, healthcheck path
502 Bad Gateway in the browserThe proxy cannot reach the containerPorts Exposes, 0.0.0.0
"404 page not found" in the browserTraefik does not recognize this domainDomains field, DNS, redeploy
503 "no available server" in the browserNo healthy containerContainer status and healthcheck
Certificate errorLet's Encrypt could not issue the certificateDNS, port 80, proxy log
"no space left on device"Disk fulldocker 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 engines field in package.json or set the NIXPACKS_NODE_VERSION environment variable. The most predictable fix is to use your own Dockerfile.
  • Missing lock file: npm ci does not run without package-lock.json. Add the lock file to the repository.
  • Variables that are empty at build time: Prefixed variables such as NEXT_PUBLIC_ and VITE_ 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:8000

The 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 /health path that returns 200 and does not require authentication.
  • The image has neither curl nor wget. 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.

  1. 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
  2. Set the Node.js memory limit. Add NODE_OPTIONS=--max-old-space-size=2048 as a build variable. The value must be smaller than the free RAM on the server.
  3. Limit concurrent builds. If several projects build at the same time, lower the number of concurrent builds to 1 in the server settings.
  4. 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.
  5. 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?
  • www and 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 acme

5. 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 -f

docker 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.

For this guide

Recommended plans

AI Hosting plans come with Coolify, Docker and the proxy preinstalled plus root access, so setup-related errors are gone from the start; if you are running out of memory, moving up a plan gives your builds room to breathe.

SA-AI-1

Coolify
Recommended

4 GB RAM

$2.75/mo

+VAT

  • Processor2 CPU
  • Disk40 GB NVMe
  • LocationIstanbul
  • 1G Port
  • Coolify Panel Preinstalled
  • Deploy with GitHub and Docker
  • Automatic SSL Certificate

SA-AI-2

Coolify

8 GB RAM

$4.32/mo

+VAT

  • Processor4 CPU
  • Disk80 GB NVMe
  • LocationIstanbul
  • 1G Port
  • Coolify Panel Preinstalled
  • Deploy with GitHub and Docker
  • Automatic SSL Certificate

SA-AI-3

Coolify

12 GB RAM

$6.29/mo

+VAT

  • Processor6 CPU
  • Disk120 GB NVMe
  • LocationIstanbul
  • 1G Port
  • Coolify Panel Preinstalled
  • Deploy with GitHub and Docker
  • Automatic SSL Certificate

AI Hosting — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.