Local build works but fails on CI

** dockerfile **

FROM python:3.13-slim

WORKDIR /api-circuitscan

COPY lib/* lib/
COPY requirements.txt requirements.txt
COPY main.py main.py
COPY models/* models/

RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    tesseract-ocr

RUN pip install --no-cache-dir numpy --timeout=100

RUN pip install --no-cache-dir scipy matplotlib networkx flask gunicorn gevent pytesseract opencv-python-headless

RUN pip install --no-cache-dir ultralytics --timeout=100

COPY . .

EXPOSE 8001

CMD ["gunicorn", "--bind", "0.0.0.0:8001", "main:app", "-k", "sync", "--timeout", "120"]

It compiles locally on my computer, but on my linux server through a jenkins CI/CD pipeline, not only does it not find apt-get tesseract-ocr and other packages, but pip install of any package always returns:
[0me[91mWARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ReadTimeoutError(“HTTPSConnectionPool(host=‘pypi.org’, port=443): Read timed out. (read timeout=15)”)’: /simple/numpy/

Even though I have tested that the server has network access to pypi, and with an infinite timeout it just hangs.

Any help is appreciated. I’m curious on how the apt-get and pip install commands work on a lower level, as that might help me understand my issue.

Is your server running in a corporate network, does it need a proxy to connect to the Internet?

What OS are you running on the server, any VMs, how did you install Docker? Any DNS services like AdGuard or Pi-Hole?