2019-03-19 14:03
浏览 53


I'm wondering how I can check that a docker image exists in a private registry (in eu.gcr.io), without pulling it.

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.

Pulling the image using the go docker client, as shown here, works. However, I don't want to pull down images just to check they exist, as they can be large.

I've tried using Client.ImageSearch, but his just searches for public images. the cloud.google.com/go package also doesn't seem to have anything for dealing with the container registry.

There's possibly this and the crane tool it contains, but I'm really struggling to figure out how it works. The documentation is... not great.

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 this answer.

Are there any docker or other packages able to do this in a cleaner way?

图片转代码服务由CSDN问答提供 功能建议

我想知道如何检查私有注册表中是否存在docker映像(在 eu中。 gcr.io ),而无需将其拉出。

我有一个用golang编写的服务,该服务需要检查docker映像是否存在才能验证配置 用户传递给它的文件。

使用go docker客户端拉取图像,如此处有效。 但是,我不想只检查图像是否存在,因为它们可能很大。

我尝试使用 Client.ImageSearch ,但他只搜索公共图像。 cloud.google.com/go 包似乎也没有任何内容 处理容器注册表。

可能有及其包含的起重机工具,但是我真的很难弄清楚它是如何工作的。 该文档不是很好。

我希望该解决方案与主机无关,而我发现的唯一选择是简单地发出一个http请求并使用其中的逻辑 答案。

是否有任何docker或其他软件包可以在其中执行此操作 一种更清洁的方式?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongzhuonao8429 2019-03-19 14:22

    Just realised the lib I've been using has an unhelpfully named client method DistributionInspect (link), which will just return the image digest and manifest, if it's found. so the image doesn't get pulled down.

    解决 无用
    打赏 举报

相关推荐 更多相似问题