Add option to docker pull to use local cache first without contacting Docker Hub
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu từ điểm vào CLI của docker pull và theo dõi cách lệnh xử lý các image có sẵn cục bộ và việc liên hệ với registry. Xác định hành vi đối với image đã được cache và image chưa được cache, sau đó xác thực rằng tùy chọn mới sẽ bỏ qua registry khi image có sẵn cục bộ nhưng vẫn pull image khi image không có sẵn cục bộ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Currently, docker pull contacts Docker Hub (or another registry), even when the requested image is already present locally and up to date. This behavior:
- Triggers unauthenticated rate limits unnecessarily.
- Makes it unsafe to use
docker pullin CI environments without Docker Hub authentication.
Please consider adding a flag to docker pull that checks the local image cache first and skips contacting the registry if the image is already available locally.
Worst of all, docker pull is currently inconsistent—it sometimes succeeds and sometimes fails, even when the image is already cached locally.
Here is an example where both images are present locally:
Pulling atlassian/bamboo-server
docker pull atlassian/bamboo-server
Using default tag: latest
latest: Pulling from atlassian/bamboo-server
Digest: sha256:b3d33daee6667c15ae3f1a9225bd85f493a23183f4d33776aa7243822d0fa820
Status: Image is up to date for atlassian/bamboo-server:latest
docker.io/atlassian/bamboo-server:latest
Pulling buildkite/agent
docker pull buildkite/agent
Using default tag: latest
Error response from daemon: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
A common workaround is to explicitly check for the image before pulling:
if ! docker image inspect ubuntu:22.04 > /dev/null 2>&1; then
docker pull ubuntu:22.04
fi
Alternatively, pulling by digest avoids the registry check:
docker pull ubuntu@sha256:<digest>
But these approaches are manual and error-prone. A built-in option (e.g. --check-cache-first) would offer a simpler and more robust solution for both local workflows and CI pipelines.
- Ngôn ngữ chính
- Go
- Star
- 6.1k
- Fork
- 2.2k
- Merge trung bình
- 1 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 47
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của docker/cli
-
kind/bug status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
kind/bug status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
kind/feature status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
kind/bug status/0-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Issue tương tự
-
bug github_actions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
registrystack/registry-stack#1393 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
JakeChampion/lang#10213 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
oasisprotocol/oasis-sdk#2523 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100