DockHostingDocs
Troubleshooting

My app built but doesn't start

The fix for “the proxy answered 502”, “listening on localhost”, and an app that exits right after starting.

The build worked, then the deploy failed while starting. The deploy page shows your app's last output: it almost always says which of these happened.

The app listens on localhost

What you see

“routed port 5000; listening: 5000 (localhost only)”, or “the proxy answered HTTP 502 (cannot reach the application)”.

Why

Your app listens on 127.0.0.1 or localhost, which only accepts connections from inside the container. Flask's app.run(debug=True), Spring's server.address and some dev servers do this.

Fix

Listen on 0.0.0.0. We set HOST=0.0.0.0 for apps that read it.

Flask: use gunicorn app:app --bind 0.0.0.0:$PORT as the start command. Spring: set SERVER_ADDRESS=0.0.0.0 in Variables. Node: app.listen(process.env.PORT, "0.0.0.0").

The app listens on another port

What you see

“routed port 8080; listening: 42073”, or a 502 with no error in the output.

Why

The port is fixed in your code (for example app.listen(3000)) and isn't the one we route to.

Fix

Read the PORT variable in your code. Or set Port in the project's Settings to the port your app uses. When we see your app on another port, we usually re-route and redeploy by ourselves.

The app exits right after starting

What you see

“the container exited or is restarting”, with an error at the end of the output.

Why

Your app crashes during start-up: a missing variable, a failed database connection, a wrong start command, or an exception in your code.

Fix

Read the last lines of the output on the deploy page: they name the problem. The usual ones:

“X is required / must be set” → add the variable. “ECONNREFUSED 127.0.0.1” → database connection. “Cannot find module” or “No such file” → check the Start command and the App folder in Settings.

The app is still starting after 5 minutes

What you see

The deploy fails after waiting about 5 minutes, and the output shows the app still booting.

Why

Very heavy start-ups (large Java apps, big models loading) on a small amount of memory.

Fix

Give the app more memory (Hobby and up, or the memory add-on), and avoid heavy work at start-up, such as downloading models: do it lazily on the first request.

Check it locally

Run your app the way we do, and open it from another device on your network:

PORT=8080 HOST=0.0.0.0 npm start

If http://<your-computer-ip>:8080 loads from your phone, it will start on DockHosting.

On this page