Next.js app restarts because its production build is missing

The application started but did not answer on any port it publishes. The deploy log has the per-port result; a worker or queue-only app can ignore this. | The application is restarting, not running. Docker reports app (Restarting (1) 17 seconds ago). Nothing answered on any published port because the process keeps exiting. Read the container output with container_service_logs; the reason it exits is there.

Seen5 times
WhereNextjs

Why it happens

The container starts Next.js on port 3000, but no production build is present in the .next directory. The process exits immediately and Docker restarts it, so the health check cannot connect. This can happen when the build runs in a different workspace or the .next output is not included in the runtime container.

What the log looks like

Deploy log
Health check: http://[ip]:3000/ did not answer — Failed to connect to [ip] port 3000app-1  | ✓ Ready in 157msapp-1  | Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server.app-1  | [panelalpha] start: serveapp-1  | Error: Could not find a production build in the '.next' directory.app-1  | Docker reports app (Restarting (1) 7 seconds ago).

Try PanelAlpha Engine yourself.

The easiest way to turn your server into a safe, controlled environment for your AI agent. Deploy, manage and maintain any project from Claude Code, Cursor, Codex or any other MCP client. Open source under Apache 2.0, free to run.

Requires Ubuntu 24.04 or 26.04 · 2 GB RAM · 1 CPURead the documentation