HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Find most popular images with `zip` and `git` on Docker Hub

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
popularwithdockerziphubgitfindandimagesmost

Problem

To speed up builds, I'd like to avoid install tools that I need on every commit with apt-get update -y && apt-get install -y git zip.

Normal way is to create custom build image, register at Docker Hub and upload it there. But I am 100% sure that there is already an up to date image that contains both git and zip tools that I need. The only question is how to find this image?

UPDATE 202004: There is no indexer for DockerHub, and there is no even indexer for Docker image contents. To start with that one could get a list of files from an image by patching dive by @wagoodman, or using https://github.com/GoogleContainerTools/container-diff

Solution

I can answer half of your question: If you have a set of images you're trying to investigate, the best way would be to use which in a new container using the image in question. This way you can quickly see if a particular image has the binaries your are looking for already on PATH:

docker run --rm ubuntu:latest which zip git
# no result

docker run --rm ubuntu:latest which bash sh
/bin/bash
/bin/sh
# ^-- both bash and sh are in the image


I don't know of a way to discover the set of images in question, as there is no manifest of files that a registry will provide. That is, yes, an image is a set of tar files, which you can extract a set of files/directory names... however, you'd still need to pull the entire image to get this information, so it would be easier to run the which command above.

There are tools for exploring information that a registry exposes (skopeo, doocker-ls, reg, manifest-tool, etc) but none of them will do exactly what you're looking for, which is "find a repository within a registry which contains an image that has a particular binary in it".

Code Snippets

docker run --rm ubuntu:latest which zip git
# no result

docker run --rm ubuntu:latest which bash sh
/bin/bash
/bin/sh
# ^-- both bash and sh are in the image

Context

StackExchange DevOps Q#10192, answer score: 2

Revisions (0)

No revisions yet.