Skip to content
Deployment fails immediately after successful build and image export
countbackpilot-glitch
OP

a month ago

Railway marks the deployment failed immediately after the Dockerfile build and image export complete. The Ollama image build for qwen3:0.6b succeeds, but no deployment error is emitted; this has happened on three deployments. Latest deployment: 2084aec6-c316-4daf-ae34-97a833e5d835. Project: 68ba4417-10b5-4f31-aaee-10697d307165. Service: 665bf52b-973e-4333-a420-3705eed62601 (skifta-ollama). Railway diagnostics recommend support because repeated redeploys are unlikely to help. Could you identify the runtime/provisioning failure after image export and advise a resolution?

$10 Bounty

4 Replies

Status changed to Awaiting Railway Response Railway • about 1 month ago


sam-a
EMPLOYEE

a month ago

This deployment never reached runtime or provisioning. It failed inside the build step at 10:27:03 UTC, a few seconds after the image export lines at 10:26:56 UTC, so no container was ever created. That is why there is no deployment error or runtime log to read.

The build log stops right after the export output without printing an error, and the dashboard shows only the generic build failure message, so the specific cause cannot be determined from this deployment's logs.


Status changed to Awaiting User Response Railway • about 1 month ago


countbackpilot-glitch
OP

a month ago

Thanks for confirming. Since then, GitHub CI has passed the CPU-only Ollama image build and private staging model/API integration, while this Railway service still fails immediately after image export. Could you check whether an account-level builder or registry issue could explain the post-export failure, or advise a supported deployment configuration? We are holding off on repeated redeploys until the failure is understood.


Status changed to Awaiting Railway Response Railway • about 1 month ago


Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 1 month ago


sundayabasi684-byte
Top 10% Contributor

a month ago

Hi @countbackpilot-glitch,

Since the employee confirmed the build dies right after the image export step (before runtime container creation), this points to a builder resource constraint specifically an OOM (Out-of-Memory) or layer compression timeout during the heavy export phase of large model blobs like qwen3:0.6b.

Even if local or GitHub CPU-only builds pass, Railway's remote builder environments handle large image layers differently. Here is how to fix and stabilize the build:

  1. Avoid Embedding Large Weights in the Docker Image

Packing model weights directly into a Docker image via RUN ollama pull qwen3:0.6b during build time bloats the image and routinely causes silent export crashes on remote builders.

  • The Fix: Switch to a lazy-load / runtime pull approach. Keep your base Docker image lean (just installing the Ollama binary), and use a Railway Persistent Volume mounted to /root/.ollama so model weights download dynamically on first container startup rather than failing during build image export.
  1. Optimize Build Memory & Multi-Layer Caching

If you must build the image with layers included:

  • Ensure your Dockerfile splits heavy operations into separate, smaller RUN commands to prevent the builder registry export pipe from timing out.
  • Add a .dockerignore file to strictly exclude unnecessary local directories, node modules, or logs that unnecessarily inflate the build context size sent to the registry exporter.

Try shifting the model download to runtime using a persistent volume mounted to your Ollama data path. It completely bypasses build-time image export failures and keeps your deployments stable!


cbx100

a month ago

A safer resolution path is to avoid baking the Qwen model into the Docker image at build time at all.

I would not infer OOM from the existing logs—the Railway employee already confirmed the exact post-export failure cause is not visible. But Railway's current Ollama/Qwen templates use a configuration that bypasses this failure boundary:

  • run the official ollama/ollama image;
  • mount a persistent volume at /root/.ollama;
  • pull the model at runtime / first start instead of during docker build;
  • persist the downloaded weights on that volume so redeploys do not re-download them;
  • expose Ollama on 0.0.0.0:11434 (or keep it private and call it over Railway private networking).

Current Railway template examples:

https://railway.com/deploy/ollama-llm-api

https://railway.com/deploy/qwen3-chat-ollama-open-webui-private-ai--qwen3-ollama-openwebui

For your specific qwen3:0.6b service, the migration test I would do is:

  1. remove RUN ollama pull qwen3:0.6b (or any equivalent model download) from the Dockerfile;
  2. attach a volume at /root/.ollama;
  3. boot Ollama normally;
  4. on startup, run/poll ollama pull qwen3:0.6b only if the model is absent, then start serving;
  5. redeploy once and verify the container reaches runtime before investigating anything else.

That does not identify the hidden builder/export failure, but it is a supported deployment shape that removes the large-model image-export step that currently prevents the service from ever reaching runtime. If this still fails before runtime with a lean ollama/ollama image and no baked model, that would be much stronger evidence of an account/builder/registry problem for Railway to investigate.

AI-use disclosure: I used AI assistance to research and draft this reply, then manually checked the recommendation against Railway's current Ollama/Qwen template pages and the employee diagnosis already in this thread.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...