[builder-next] fix squashing base image layer#39187
[builder-next] fix squashing base image layer#39187Blyschak wants to merge 2 commits intomoby:masterfrom
Conversation
Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
22c120e to
c22b35b
Compare
Signed-off-by: Stepan Blyshchak <stepanblischak@gmail.com>
| func(i int, tp *specs.Platform) { | ||
| eg.Go(func() error { | ||
| st, img, err := dockerfile2llb.Dockerfile2LLB(ctx, dtDockerfile, dockerfile2llb.ConvertOpt{ | ||
| st, img, baseImg, err := dockerfile2llb.Dockerfile2LLB(ctx, dtDockerfile, dockerfile2llb.ConvertOpt{ |
There was a problem hiding this comment.
FWIW; the changes made in the vendor directory should be upstreamed too github.com/moby/buildkit.
I'll add a needs-vendoring label
|
ping @tonistiigi @AkihiroSuda PTAL |
|
ping @tonistiigi @AkihiroSuda PTAL |
|
Looks like this PR needs more work to be taken out of draft mode. @Blyschak you still working on this or should it be closed? |
|
perhaps @tonistiigi could have a look what's needed; I think a fix is still desirable to get feature parity |
|
Another related problem trying to solve the need to keep the squashing up to the FROM layer: I'm currently using buildkit to build the image, and then still relying on legacy builder to squash it To reproduce, just do echo | DOCKER_BUILDKIT=1 docker build -t a -<<EOF
FROM busybox
RUN touch foo
RUN touch foo2
RUN touch foo3
EOF
echo "FROM a"| DOCKER_BUILDKIT="" docker build --squash -t b -I tried with to build an image with The same is working with current |
|
The error about experimental session ("Error response from daemon: experimental session with v1 builder is no longer supported...") is unrelated; that error is fixed in #41648, which will be in the next beta/rc of docker 20.10 |
|
This needs reviving. How can I help??? Keen to see this over the line as it's critical for me to have --squash and docker claims the old engine is going to be removed with zero for. buildkit. |
Signed-off-by: Stepan Blyshchak stepanblischak@gmail.com
Fixes #38903
- What I did
I am trying to fix "--squash" using DOCKER_BUILDKIT=1 squashes the top layers and the base image always resulting in one layer. Legacy builder behavior is to not squash the base layer.
This is quite important because multiple images that were squashed cannot share the same base image affecting the disk space (especially when dockers run on device which has a small drive)
- How I did it
Export base image config from Dockerfile2LLB, so later can pass to SquashImage.
Here I changed the input of SquashImage from base ID string to Image object, since when base image is resolved remotely it is not present in ImageStore, which is yet another behavior change comparing to legacy builder:
TODO: maybe it is better to pull base image from remote in exporter and so SquashImage will work as it is right now?
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)