buildx
buildx copied to clipboard
Expose default dockerfile syntax version being used
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.
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.
Ah nice. Didn't realize inspect showed buildkit version. Would be nice if it would show the dockerfile syntax version there as well.
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