title: check existence of docker image in private registry in Go
body: <p>I'm wondering how I can check that a docker image exists in a private registry (in <code>eu.gcr.io</code>), without pulling it.</p>
  
  <p>I have a service, written in golang, which needs to check for the existence of a docker image in order to validate a config file passed to it by a user.</p>
  
  <p>Pulling the image using the go docker client, as shown <a href="https://stackoverflow.com/questions/44869498/google-container-registry-golang-moby-authentication">here</a>, works. However, I don't want to pull down images just to check they exist, as they can be large.</p>
  
  <p>I've tried using <a href="https://godoc.org/github.com/docker/docker/client#Client.ImageSearch" rel="nofollow noreferrer">Client.ImageSearch</a>, but his just searches for public images. the <a href="https://godoc.org/cloud.google.com/go" rel="nofollow noreferrer">cloud.google.com/go</a> package also doesn't seem to have anything for dealing with the container registry.</p>
  
  <p>There's possibly <a href="https://godoc.org/github.com/google/go-containerregistry" rel="nofollow noreferrer">this</a> and the crane tool it contains, but I'm really struggling to figure out how it works. The documentation is... not great.</p>
  
  <p>I'd like the solution to be host agnostic, and the only option I have found is to simply make a http request and use the logic from <a href="https://stackoverflow.com/a/52206527/5236295">this</a> answer.</p>
  
  <p>Are there any docker or other packages able to do this in a cleaner way?</p>