Docker build on Railway is stuck indefinitely
parag7823
HOBBYOP

3 months ago

[internal] load metadata for docker.io/library/python:3.9-slim
[internal] load metadata for docker.io/library/node:20-alpine

After ~30 minutes, the build times out with:

Build Failed: build daemon returned an error < failed to run Build function: Canceled: context canceled >

ROOT CAUSE

Railway's Docker build environment has slow/blocked access to Docker Hub.

The build cannot fetch metadata for base images from Docker Hub within the timeout window.

This is NOT a code issue - it's an infrastructure/network issue with Railway's build servers.

WHAT WE ALREADY TRIED

Attempt 1: Blamed SHAP Library x emoji

What we did: Removed shap==0.43.0 from

backend-requirements.txt

Why it failed: The build was stuck BEFORE pip runs, so SHAP wasn't the issue.

Result: Didn't help - build still timed out at Docker metadata fetch.

Attempt 2: Added PyPI Mirror Optimization warning emoji

What we did: Added Aliyun PyPI mirror to Dockerfile:

dockerfile
RUN mkdir -p ~/.pip && echo "[global]\nindex-url = https://mirrors.aliyun.com/pypi/simple/" > ~/.pip/pip.conf

Why it failed: The build never gets to pip install - it's stuck at base image pull.

Result: Didn't help - build still times out at Docker metadata fetch.

Attempt 3: Added BuildKit Optimization warning emoji

What we did: Added BuildKit syntax to Dockerfile:

dockerfile
# syntax=docker/dockerfile:1.4

Why it failed: BuildKit helps with caching, but doesn't solve the base image pull timeout.

Result: Didn't help - build still times out at Docker metadata fetch.

Attempt 4: Verified .dockerignore white_check_mark emoji

What we did: Checked

.dockerignore file (already optimized)

Result: File is good, but doesn't solve the base image pull issue.

Solved

8 Replies

Railway
BOT

3 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


3 months ago

Hey! Can you share the service link? Just open that service where it failed the build and copy paste the URL from the browser here.

Are you using the metal builder? You can check that in the service settings.


medim

Hey! Can you share the service link? Just open that service where it failed the build and copy paste the URL from the browser here.Are you using the metal builder? You can check that in the service settings.

parag7823
HOBBYOP

3 months ago


3 months ago

Try disabling the metal builder in the service settings for a quick fix


medim

Try disabling the metal builder in the service settings for a quick fix

parag7823
HOBBYOP

3 months ago

Thanks. It worked


Railway
BOT

3 months ago

Hello!

We're acknowledging your issue and attaching a ticket to this thread.

We don't have an ETA for it, but, our engineering team will take a look and you will be updated as we update the ticket.

Please reply to this thread if you have any questions!


Railway
BOT

3 months ago

Hello!

We've escalated your issue to our engineering team.

We aim to provide an update within 1 business day.

Please reply to this thread if you have any questions!

Status changed to Awaiting User Response Railway 3 months ago


Railway
BOT

3 months ago

🛠️ The ticket Build Process Stalling Issue has been marked as in progress.


Railway
BOT

3 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 3 months ago


Railway
BOT

2 months ago

✅ The ticket Build Process Stalling Issue has been marked as completed.


Loading...