buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Expose default dockerfile syntax version being used

Open miki725 opened this issue 9 months ago • 3 comments

Description

Currently dont think there is an easy way to figure out what dockerfile syntax is going to be used if dockerfile does not define # syntax=... directive.

My understanding is that buildx pins a version of buildkit:

https://github.com/docker/buildx/blob/afcb609966dc748a91cb5889fa63a34034117495/go.mod#L29

which in turn contains a frontend implementation in https://github.com/moby/buildkit/tree/28264b45d924d654616f1fba1467aa0a4cefaab5/frontend

To map that to dockerfile syntax as published in https://docs.docker.com/build/dockerfile/release-notes/ is non-trivial.

Sometimes it would be useful to know what capabilities are available in dockerfile syntax by being able to query/find out what version of dockerfile is used by default.

Perhaps docker buildx version can be extended to include that information or maybe adding docker buildx info command similar to docker info which will show more information about internal buildx sub-systems is going to be very useful.

miki725 avatar May 15 '24 17:05 miki725

My understanding is that buildx pins a version of buildkit:

You can run docker buildx inspect to see the BuildKit version of the current builder instance (that can then be mapped to Dockerfile version). go.mod has the version buildx libraries used when it was compiled that could be different from the daemon version. For instances created with buildx create, they always use the latest stable buildkit version if one was not set with the flags.

tonistiigi avatar May 16 '24 00:05 tonistiigi

Ah nice. Didn't realize inspect showed buildkit version. Would be nice if it would show the dockerfile syntax version there as well.

miki725 avatar May 16 '24 03:05 miki725

Would be nice if it would show the dockerfile syntax version there as well.

When implementing the info service in BuildKit I was thinking it would be useful as well: https://github.com/moby/buildkit/pull/2725#issuecomment-1068205802 but seems a bit messy to manage in our code base: https://github.com/moby/buildkit/pull/2725#discussion_r828235303

Relevant commit: https://github.com/crazy-max/buildkit/commit/43ad8abf96907b88fc7dbcd44c6fc532a19227f0

crazy-max avatar May 16 '24 13:05 crazy-max