Skip to content

Prerendering does not work when building Docker container #6275

@NormySan

Description

@NormySan

Which project does this relate to?

Start

Describe the bug

When trying to build a TanStack Start project in SPA mode with Docker Vite fails to connect to the server. The build works fine outside of Docker.

3.276 [nitro] ✔ You can preview this build using bun run .output/server/index.mjs
3.277 [prerender] Prerendering pages...
3.305
3.305  ╭───────────────── [Build Info] ────────────────────╮
3.305  │                                                   │
3.305  │  - Build Directory: .output                       │
3.305  │  - Date: 1/2/2026, 5:55:52 AM                     │
3.305  │  - Nitro Version: 3.0.1-20251230-165713-6e801e22  │
3.305  │  - Nitro Preset: bun                              │
3.305  │                                                   │
3.305  ╰───────────────────────────────────────────────────╯
3.305
3.305 ℹ Spawning preview server...
3.305 ℹ bun run ./server/index.mjs
3.305
3.324 ➜ Listening on: http://localhost:46317/ (all interfaces)
3.841 [prerender] Concurrency: 10
3.842 [prerender] Crawling: /
3.855 [prerender] Prerendered 0 pages:
3.859 error: Unable to connect. Is the computer able to access the url?
3.859   path: "http://localhost:3000/",
3.859  errno: 0,
3.859   code: "ConnectionRefused"

I've also tried forcing the Nitro port to run at 3000 which ends up with the Vite prerender server failing to start instead.

Your Example Website or App

https://github.com/NormySan/tanstack-start-spa-nitro

Steps to Reproduce the Bug or Issue

  1. Download repository
  2. Build the docker image with docker build -t tanstack-start/nitro .

Expected behavior

I expect it to be able to connect to the server and to the pre-rendering.

Screenshots or Videos

No response

Platform

  • Router / Start Version: Router 1.132.0 and Start 1.132.0
  • Nitro: Nightly at latest
  • Runtime: Bun
  • OS: Mac OS
  • Bundler: Vite
  • Bundler Version: 7.1.7

Additional context

Similar to the following issue:
#5967 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions