-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContainerConfig field missing with buildkit #2868
Comments
buildkit built images are not providing the ContainerConfig we are reading labels from. Instead, everything is populated in the Config field of `inspect`. We should eventually have better visibility about those fields in this issue: docker/cli#2868 Meanwhile, we should support it the best way possible. Benefit from having to do this change to mutualise the label parsing logic so we are consistent in how we manage the label lookup and encoding (prefer yaml and fallback to string when possible) Fixes: #119
buildkit built images are not providing the ContainerConfig we are reading labels from. Instead, everything is populated in the Config field of `inspect`. We should eventually have better visibility about those fields in this issue: docker/cli#2868 Meanwhile, we should support it the best way possible. Benefit from having to do this change to mutualise the label parsing logic so we are consistent in how we manage the label lookup and encoding (prefer yaml and fallback to string when possible) Fixes: #119
I think this is expected, because of how BuildKit is implemented. In the "non-buildkit" situation, a As a side-effect, the classic builder includes the information of the container that was run for a step (and "committed" to an image); but the container config (besides cache-matching for the classic builder) is not needed for the image itself (the BuildKit takes a fully different approach, and for many steps won't be using a container (or at least, not a container per step), and because of that does not include this information.
Hm, yes, I can see it being useful to improve the description for the image inspect API endpoint. There's likely a couple of reasons for that (not an excuse; bear with me); one is that some types/struct are used for multiple purposes (but with optional fields, depending on where they're used). The other is that For images, the format was later formalised in the OCI image spec (https://github.com/opencontainers/image-spec/blob/v1.0.1/config.md) While the images stored in the local image cache are OCI compliant, the specification allows for additional implementation-specific fields to be present (for reasons like the one described here);
So, all of those are not an "excuse", and I agree that if possible, we should update the API description to clarify that this information is "optional" (and may not be present), and it's purpose when present (which is for the "classic" builder to perform cache-checking). @tjamet With all of the above; is there specific information you need that is not present in the "formal" fields (defined in the OCI spec)? |
Great, thanks for the cristal clear answer. So var Whalebrew relies exclusively on labels, volumes, and entrypoints, i.e. the basics. |
Any plan to compatible buildkit with docker-compose-plugin ? |
Closing this ticket, as the ContainerConfig field has been deprecated and removed for current API versions |
First of all, I am unsure the issue needs to be opened here, in moby or in buildkit. Feel free to redirect me wherever is needed.
Description
Steps to reproduce the issue:
printf 'FROM scratch\nLABEL some=defined\n' | env DOCKER_BUILDKIT=1 docker build -t buildkit -
printf 'FROM scratch\nLABEL some=defined\n' | env DOCKER_BUILDKIT=0 docker build -t legacy -
docker inspect legacy | jq '.[0].ContainerConfig'
docker inspect buildkit | jq '.[0].ContainerConfig'
Describe the results you received:
In the case of the legacy build, the ContainerConfig field is filled with the labels
In the case of buildkit, no label is provided
Describe the results you expected:
I would have expected backward compatibility between both builds, or a deprecation notice in the API but didn't find anything.
This is triggered by a bug on a project I help maintain whalebrew/whalebrew#119 that, probably wrongly, uses the
ContainerConfig
field to inspect the image.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
docker for mac
The text was updated successfully, but these errors were encountered: