I'm trying to build a Docker image for my Python/FastAPI project. My requirements.txt includes packages from both public PyPI and two private GitLab PyPI repositories. Dockerfile excerpt: FROM *****:*-slim-bullseye ARG FUNCTION_DIR WORKDIR ${FUNCTION_DIR} COPY --from=build-image / / ARG PIP_EXTRA_INDEX_URL ENV PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL} COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt Build command: docker build --progress=plain --build-arg PIP_EXTRA_INDEX_URL="https://gitlab.*********.com/apie/SE/projects/145/packages/pypi/simple/ https://username:token@gitlab.**************.com/apie/SE/projects/888/packages/pypi/simple/" -t fast_api . requirements.txt: fastapi[standard]==0.115.12 mangum==0.19.0 uvicorn==0.34.0 MTPTS[full]>=1.99.44 TSSA>=1.99.1 Problem: The build fails at the pip install step with a generic error: ERROR: failed to solve: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1 1440 /usr/local/bin/dockerd --containerd /run/containerd/containerd.sock --pidfile /run/desktop/docker.pid --swarm-default-advertise-addr=eth0 --host-gateway-ip 192.***.**.*** I have confirmed that: The PIP_EXTRA_INDEX_URL is quoted in the build command. The credentials are correct. The Dockerfile uses ARG and ENV for PIP_EXTRA_INDEX_URL. Questions: Is my usage of PIP_EXTRA_INDEX_URL with multiple indexes correct for pip in Docker? Is there a better way to pass multiple private indexes with authentication to pip in a Docker build? How can I debug what pip is actually doing inside the container to see which index it is failing on? Any help or suggestions are appreciated! Continue reading...