I’m trying to build my Docker image, but it’s taking forever. Even when I leave it to continue building, it fails after a long time. Here is my Dockerfile:
FROM ubuntu:24.04
# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip
WORKDIR /ner
COPY requirements.txt .
# Install required packages
RUN pip install -r requirements.txt --break-system-packages
COPY . .
I think the problem may be in the requirements file. Here is my requirements.txt
:
tensorflow==2.16.1
pydantic-settings==2.2.1
transformers==4.40.1
fastapi==0.111.0
torchvision==0.18.0
torch==2.3.0
tqdm==4.66.2
numpy==1.26.4
scikit-learn==1.4.2
pandas==2.2.1
I tried to build it using this command:
docker build -t train .
The process is too slow and eventually fails. Could the issue be related to the size of these packages or their dependencies? Are there any optimizations I can apply to speed up the build process or resolve this issue?
Khaled Emam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.