-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Can't schedule build of dependent images #2354
Comments
There's been some discussion about providing overrides in docker/buildx#447 (comment) . Notice that these would be configured by the user. The build requests are all independent as far as buildkit is concerned. You can't set these overrides automatically as well as then you would have a cross-dependency. If compose chooses to schedule some requests sequentially and use image store to access local images for base images that is up to compose to decide. |
a "client-side" solution would require client (compose, or bake) to parse the Dockerfiles, including support for |
You are asking two independent builds to synchronize with themselves without any constraints given. As I wrote, doing this automatically isn't even theoretically possible because of the infinite dependency loop it creates. The decision for compose authors would be if this pattern should be forbidden or if it is important enough for the compose to not trigger all the requests together but run them sequentially(eg. how the old builder did). If you really want to detect the dependency chains buildkit could possibly provide you that info(in some cases it may not ever be possible without triggering builds, eg. dockerfile cross-linking etc). I think that part should already be possible with #2311 |
I don't understand why this would be "even theoretically possible" as I have no idea about buildkit internals, but sounds clear to me you don't see a simple way to address this need, so will need to make |
What I don't see possible is the automatic aspect of it. Eg. look at the syntax in docker/buildx#447 (comment) . If these rules would be added automatically then it says "build A into foo, if you see bar then replace it with the result of B", and "build B into bar, if you see foo then replace it with the result of A". The API would not even allow you to make such requests as to build A you would need result of B first and you can get reference for it because it depends on A. For a practical case, the user would have no problem of saying which replacement they want and what they don't need. Eg. with syntax similar to described in that comment or maybe for compose you can repurpose Lets continue to track it in docker/buildx#447 . If you want buildkit to export more info from a build for some client side implementation then create a separate issue for that in here. |
reading docker/buildx#447 "only true for docker daemon driver" this means we are stuck because buildkit was designed too generic :'( docker/buildx#447 is indeed exactly what a compose user would expect build to manage. I hardly can imagine how to manage such things client-side. on compose v2 it seems we don't have any better choice but build image sequentialy, like docker-compose did with classic builder |
That's not true actually. |
for some reason I never fully understood, Dockerfile composition like moby/moby#735 never have been approved, which would be a simple and efficient way for services to define a common dockerfile parent and avoid such de facto feature in docker-compose to support build dependencies |
This issue was initially reported as docker/compose#8538
build.Options
matching service definitions in a compose file are set with independent context paths and image tag. If a the service is set by Dockerfile to declareFROM <another_service>
, buildkit should know about this base image being part of the enclosing build request, and manage this implicit dependency.The text was updated successfully, but these errors were encountered: