docker icon indicating copy to clipboard operation
docker copied to clipboard

[RFC] dind: include git to support build from remote source

Open thaJeztah opened this issue 4 years ago • 5 comments

This patch installs git in the "dind" variants of the image, to allow using docker build to build from a remote source.

This change adds ~13MB to the image size (after decompressing). Below is a list of image variants ("dind-git" is the local build) for comparison:

REPOSITORY    TAG              IMAGE ID       CREATED          SIZE
docker        20.10-dind-git   35ca9f3f5cbf   10 seconds ago   270MB
docker        20.10-dind       d1a6345c23f3   2 weeks ago      257MB
docker        20.10-git        5675ce6408db   2 weeks ago      253MB
docker        20.10            6e081696197d   2 weeks ago      241MB

And ~6MB compressed (docker save | gzip > file.tgz)

-rw-r--r--  1 sebastiaan  staff    76M Feb 17 17:20 before.tgz
-rw-r--r--  1 sebastiaan  staff    82M Feb 17 17:21 after.tgz

Installing git is done in a separate RUN, so that the layer can be shared between the "20.10-git" and "20.10-dind" variants of the image in situations where both variants are used on the same machine.

thaJeztah avatar Feb 17 '21 16:02 thaJeztah

@tianon @tonistiigi I know this has been discussed before (i.e.; keeping the images "small" where possible); I thought it would be worth discussing again, to provide a better experience for users that use the dind variant for building. The difference in size (for the image pulled) looks to be "limited" (6MB), and of course, there's the non-dind variants that are smaller for users that don't need to run the daemon.

thaJeztah avatar Feb 17 '21 16:02 thaJeztah

You mean specifically for buildkit, right? In non-buildkit, the preferred mode is that the client invokes git (which IMO makes a lot more sense).

tianon avatar Feb 17 '21 16:02 tianon

You mean specifically for buildkit, right?

Correct

In non-buildkit, the preferred mode is that the client invokes git

In that case, it could still be useful if the client inside the image is used

which IMO makes a lot more sense

Conveniently removing myself from that discussion, but @tonistiigi probably can provide input on that if needed 😅

thaJeztah avatar Feb 17 '21 16:02 thaJeztah

In non-buildkit, the preferred mode is that the client invokes git

In that case, it could still be useful if the client inside the image is used

It could, but that is the use case for the git variant. 😅

tianon avatar Feb 17 '21 17:02 tianon

I guess on the size argument, https://github.com/docker-library/golang/issues/250#issuecomment-451201761 is pretty relevant.

(From that point of view, it's pretty tempting to drop the git variants altogether.)

tianon avatar Aug 20 '21 23:08 tianon