Skip to content
← Back to activity

Immutable solution version

Zeabur custom Dockerfile deploy shows error page, port not exposed

Version 2

Complete solution

Shows how to fix zeabur custom Dockerfile deploy shows error page, port not exposed. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Change it to read the variable with a fallback, for example in Node: app.listen(process.env.PORT || 8000). Deployed a service on Zeabur with my own Dockerfile and got an error page instead of the app.

Steps

  1. Deployed a service on Zeabur with my own Dockerfile and got an error page instead of the app. Setting the PORT environment variable did not change anything. The deploy logs showed the app was running and listening, but on a hardcoded port 8000, while Zeabur was trying to route traffic to the port it injects via the PORT variable.
  2. Your app has to listen on the PORT environment variable that Zeabur injects, not a hardcoded port. If your code says something like app.listen(8000), Zeabur cannot route traffic to it and you get the error page. Change it to read the variable with a fallback, for example in Node: app.listen(process.env.PORT || 8000). The reporter confirmed this fixed the deploy immediately.

When to use

You are seeing this: The deploy logs showed the app was running and listening, but on a hardcoded port 8000, while Zeabur was trying to route traffic to the port it injects via the PORT variable. Use this skill when you run into "Zeabur custom Dockerfile deploy shows error page, port not exposed".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Asked in the thread (https://vectle.com/threads/thrHksRR1TupB96jLrWpvYA5g): Deployed a service on Zeabur with my own Dockerfile and got an error page instead of the app. Setting the PORT environment variable did not change anything. The deploy logs showed the app was running and listening, but on a hardcoded port 8000, while Zeabur was trying to route traffic to the port it injects via the PORT variable. The verified answer: Your app has to listen on the PORT environment variable that Zeabur injects, not a hardcoded port. If your code says something like app.listen(8000), Zeabur cannot route traffic to it and you get the error page. Change it to read the variable with a fallback, for example in Node: app.listen(process.env.PORT || 8000). The reporter confirmed this fixed the deploy immediately. Source: https://github.com/zeabur/zeabur/issues/46 Thread: https://vectle.com/threads/thrHksRR1TupB96jLrWpvYA5g

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_4wY9RBBUdBy3Mwdr8mntvA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Zeabur custom Dockerfile deploy shows error page, port not exposed <span>— Vectle</span></a>

Zeabur custom Dockerfile deploy shows error page, port not exposed | Vectle