Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling by digest should be a NOP if the image is already present #36195

Open
jonjohnsonjr opened this issue Feb 2, 2018 · 1 comment
Open
Labels
area/distribution kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Comments

@jonjohnsonjr
Copy link
Contributor

Description

When pulling by digest, it seems like docker doesn't check to see if it already has that image locally before talking to the registry.

Adding a check here could skip downloading the manifest entirely.

Would you be open to a PR to fix this? Or is it intentional?

Steps to reproduce the issue:

$ time docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
Digest: sha256:e27e9d7f7f28d67aa9e2d7540bdc2b33254b452ee8e60f388875e5b7d9b2b696
Status: Image is up to date for ubuntu:latest

real	0m1.132s
user	0m0.016s
sys	0m0.012s


$ time docker pull ubuntu@sha256:e27e9d7f7f28d67aa9e2d7540bdc2b33254b452ee8e60f388875e5b7d9b2b696
sha256:e27e9d7f7f28d67aa9e2d7540bdc2b33254b452ee8e60f388875e5b7d9b2b696: Pulling from library/ubuntu
Digest: sha256:e27e9d7f7f28d67aa9e2d7540bdc2b33254b452ee8e60f388875e5b7d9b2b696
Status: Image is up to date for ubuntu@sha256:e27e9d7f7f28d67aa9e2d7540bdc2b33254b452ee8e60f388875e5b7d9b2b696

real	0m1.150s
user	0m0.008s
sys	0m0.016s

Describe the results you received:

Pulling ubuntu by tag and pulling it by digest both talk to the registry.

Describe the results you expected:

The digest pull should be effectively instant since we already have it.

Output of docker version:

Client:
 Version:	17.12.0-ce
 API version:	1.35
 Go version:	go1.9.2
 Git commit:	c97c6d6
 Built:	Wed Dec 27 20:11:19 2017
 OS/Arch:	linux/amd64

Server:
 Engine:
  Version:	17.12.0-ce
  API version:	1.35 (minimum version 1.12)
  Go version:	go1.9.2
  Git commit:	c97c6d6
  Built:	Wed Dec 27 20:09:54 2017
  OS/Arch:	linux/amd64
  Experimental:	false
@osharav
Copy link

osharav commented Nov 12, 2018

Reproduced also in version:
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:58 2018
OS/Arch: linux/amd64
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:24 2018
OS/Arch: linux/amd64
Experimental: false

This issue impacts us because we pull a large number of base images to perform our multi stage build.
Since we are using digests to pin specific images this takes much longer than it should.
tcpdump confirms that communication takes place between the client and the server during the pull operation - @jonjohnsonjr explained exactly why this does not need to happen.

If you are open for a PR - we can give it a go.

Thanks! (for the entire project, and for reading this)
Omer.

@thaJeztah thaJeztah added the kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. label Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distribution kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.
Projects
None yet
Development

No branches or pull requests

4 participants