docker / docker/cli

Add option to docker pull to use local cache first without contacting Docker Hub

Open
#6,082 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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 pull in 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker pull CLI entry point and trace how the command handles locally available images and registry contact. Define the behavior for cached and uncached images, then validate that the new option skips the registry when an image is available locally while still pulling when it is not.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.