docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit
Apache License 2.0
3.57k stars 482 forks source link

DefaultImage should be a semver release of Buildkit #419

Open crazy-max opened 4 years ago

crazy-max commented 4 years ago

https://github.com/docker/buildx/blob/8bce430f4d74c9a9ca72a46139804e88502d4b78/driver/bkimage/bkimage.go#L4-L5

To make debugging easier, the default image should be set to a Buildkit version like moby/buildkit:v0.7.2 or maybe extract current Buildkit version dynamically from go.mod. Same could be applied for DefaultRootlessImage.

tonistiigi commented 4 years ago

moby/buildkit:buildx-stable-1 and moby/buildkit:v0.7.2 is the same image (atm).

 # docker buildx imagetools inspect --raw moby/buildkit:buildx-stable-1 | openssl dgst -sha256
c5dbe36aa78f10ec70978ecea8c731f5b8ba2dfaf8de43c17263fba1b212f433
 # docker buildx imagetools inspect --raw moby/buildkit:v0.7.2 | openssl dgst -sha256
c5dbe36aa78f10ec70978ecea8c731f5b8ba2dfaf8de43c17263fba1b212f433

Buildx defalts to last stable buildkit. Special tag is used so that buildx can always pick up the last (compatible, that is what -1 is for) release without requiring a new release of buildx.

We could add some annotations to describe the image. You can already run --version on it.

 # docker run --rm moby/buildkit:buildx-stable-1 --version
buildkitd github.com/moby/buildkit v0.7.2 22e230744171b4442101731951bbbecf97796ea5
crazy-max commented 4 years ago

@tonistiigi

Special tag is used so that buildx can always pick up the last (compatible, that is what -1 is for) release without requiring a new release of buildx.

Ok I would have thought that the buildkit version used as DefaultImage should be strictly linked to the buildkit version in the go.mod.

We could add some annotations to describe the image. You can already run --version on it.

Yes but I think for the average user it should clearly show the current buildkit version used when a builder is created. Annotations looks a good solution!

crazy-max commented 3 years ago

@tonistiigi Now that buildkit v0.8.0 is out and the tagging has changed, do you think we should change the behavior also on buildx and have instead:

 DefaultImage         = "moby/buildkit:latest"
 DefaultRootlessImage = "moby/buildkit:rootless" 
tonistiigi commented 3 years ago

I updated buildx-stable-1 . Forgot about rootless, we need a similar tag for that and switch to that tag in code.

Reason for not using latest is:

Buildx defaults to last stable buildkit. Special tag is used so that buildx can always pick up the last (compatible, that is what -1 is for) release without requiring a new release of buildx.

So we leave ourselves an option to do an incompatible release (for buildx) that we don't want to auto upgrade.