Closed
Description
openedon Dec 10, 2019
I am trying to find a cheap way to get the image SHA, if I do docker inspect it takes 0.07 s
$ time docker inspect --format='{{.Id}}' ubuntu
sha256:775349758637aff77bf85e2ff0597e86e3e859183ef0baba8b3e8fc8d3cba51c
real 0m0.073s
user 0m0.035s
sys 0m0.033s
however if I use go-containerregistry it will take 4s,
ref, _ := name.ParseReference("ubuntu", name.WeakValidation)
img, _ := daemon.Image(ref)
m, _ := img.Manifest()
is there any cheaper way to get the image ID using go-containerregistry ?
I also tried crane.Digest that still takes 2.1 seconds.
fmt.Println(crane.Digest("ubuntu"))
Update: I also tried getting it through config but it is still 1.95 seconds
code:
ref, _ := name.ParseReference("ubuntu", name.WeakValidation)
img, _ := daemon.Image(ref)
cf, _ := img.ConfigName()
fmt.Println(cf)
time
$ time ./example1
sha256:775349758637aff77bf85e2ff0597e86e3e859183ef0baba8b3e8fc8d3cba51c
real 0m1.954s
This would be an important improvment for iterative development on minikube. when users constantly rebuild an image and push.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment