Build failing with "Network is unreachable" when adding PPA (5th attempt since yesterday evening (FR time))
christopherotondo7
PROOP

7 months ago

Hi Railway team,

I've been experiencing persistent build failures (this is my 5th attempt) due to network connectivity issues in the build environment.

Error: During the Docker build, the add-apt-repository -y ppa:deadsnakes/ppa command fails because Launchpad's API is unreachable:

OSError: [Errno 101] Network is unreachable

The full traceback shows httplib2 failing to establish a socket connection to api.launchpad.net.

Build step failing:

dockerfile

RUN apt-get update && apt-get install -y ... \
  && add-apt-repository -y ppa:deadsnakes/ppa \
  && apt-get update && apt-get install -y python3.11 ...

Details:

  • This is not a code change issue - the same Dockerfile worked previously
  • The error occurs consistently across multiple rebuild attempts
  • The build runner appears to have no outbound network access to Ubuntu/Launchpad services

Could you please investigate whether there's a network issue with the build runners in my region, or if there are any known outages affecting external connectivity during builds?

Thanks, Christophe

(it is happening on my "new-api" env in railway "step_app_railway")

$20 Bounty

1 Replies

Railway
BOT

7 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open Railway 7 months ago


youkamii
FREETop 5% Contributor

15 days ago

The failing network call is made by add-apt-repository to Launchpad while the image is being built. It happens before Railway starts your application, so service runtime networking settings will not change this build step.

If the reason for adding ppa:deadsnakes/ppa is only to install Python 3.11, the most reliable fix is to remove the PPA entirely and start from the official Python 3.11 image:

FROM python:3.11-slim-bookworm

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

WORKDIR /app

# Add only the OS libraries your Python packages actually require.
RUN apt-get update \
    && apt-get install -y --no-install-recommends build-essential \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . ./

CMD ["python", "main.py"]

This removes the Launchpad API and PPA as build dependencies while still giving you the requested Python version. Railway automatically detects a repository-root Dockerfile and builds it; its FastAPI guide uses the same official-Python-image approach:

Replace main.py and the OS package list with your application's real entry point and dependencies. If this is a web service, make sure that entry point binds to 0.0.0.0 and Railway's PORT value.

If you truly need that specific Ubuntu PPA rather than Python 3.11 itself, then this workaround does not diagnose the build-runner route. In that case, post the failed Railway build ID, runner region, exact UTC timestamp, and whether curl -4 -I https://api.launchpad.net succeeds in the same Docker build. Those details let Railway investigate the egress path without exposing project variables. Repeating the unchanged build will not remove the external PPA dependency.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...