docker
build_error
ai_generated
true
ERROR: Service 'app' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
ID: docker/container-exit-code-1-during-build
82%Fix Rate
88%Confidence
1Evidence
2024-01-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Docker 24.0.7 | active | — | — | — |
| Docker 25.0.3 | active | — | — | — |
| Docker 23.0.6 | active | — | — | — |
Root Cause
A RUN command in Dockerfile fails, usually due to missing dependencies, network issues, or incorrect package versions.
generic中文
Dockerfile 中的 RUN 命令失败,通常由于缺少依赖、网络问题或软件包版本不正确。
Official Documentation
https://docs.docker.com/engine/reference/builder/#runWorkarounds
-
85% success Check the specific error message in the build output (e.g., 'Could not find a version that satisfies the requirement'). Then update requirements.txt or base image. Example: use 'pip install --upgrade pip' before installing requirements.
Check the specific error message in the build output (e.g., 'Could not find a version that satisfies the requirement'). Then update requirements.txt or base image. Example: use 'pip install --upgrade pip' before installing requirements.
-
75% success If network issues, add a retry mechanism in the RUN command: RUN pip install -r requirements.txt || (sleep 5 && pip install -r requirements.txt)
If network issues, add a retry mechanism in the RUN command: RUN pip install -r requirements.txt || (sleep 5 && pip install -r requirements.txt)
中文步骤
Check the specific error message in the build output (e.g., 'Could not find a version that satisfies the requirement'). Then update requirements.txt or base image. Example: use 'pip install --upgrade pip' before installing requirements.
If network issues, add a retry mechanism in the RUN command: RUN pip install -r requirements.txt || (sleep 5 && pip install -r requirements.txt)
Dead Ends
Common approaches that don't work:
-
80% fail
Adding --no-cache-dir to pip install does not fix underlying package conflicts or network errors.
-
90% fail
Running the command manually inside a running container without the correct base image may succeed but fail during build due to different environment.