-
Notifications
You must be signed in to change notification settings - Fork 442
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
Reproducable: bake creates un-prunable files in overlay2 #2061
Comments
Thanks for bringing this up! I also encoutered similar problems on my system, but couldn't find any solution but to reinstall docker every time |
This looks similar to moby/moby#46136 |
That might indeed be the same problem as we are facing. Is there an easy way for me to test the changes in moby/moby#45966 ? Or will I need to wait for a release of moby and then subsequently docker / buildx? I couldn't find a straightforward way of upgrading buildkit alone and my buildx already seems to be on the latest version. |
Tried to use buildx bake, but due to this issue I will revert to compose. |
As far as I understood the discussion on moby/moby#46136 Since docker v25 was released last week, we installed it:
Buildkit seems to be v0.12 as well:
But we are still facing the issue described above :( Can anyone comment? |
Contributing guidelines
I've found a bug and checked that ...
Description
Up front: Sorry for the wall of text, this problem seems to be very elusive...
One of our docker hosts frequently ran out of disk space, despite pruning containers, logs, images, volumes and build cache.
The directory "/var/lib/docker/overlay2" often used about 100GB, while:
docker ps -a
showed nothingdocker volume ls
showed nothingdocker images -a
showed nothingdocker system df
showed 0 bytes being usedFor pruning we ran:
Whenever this situation occurred, the only thing we could do was uninstalling docker, removing
/var/lib/docker
and reinstalling it...I did not tick "there are no open or closed issues..." because there are several issues / forum threads out there along the lines of "/var/lib/docker/overlay2 fills up my disk". Usually these come down to the author not knowing about the
docker (builder) prune
commands or all of the additional flags that can be set for these commands.I am quite confident that with the prune commands I mentioned above,
/var/lib/docker/overlay2
should be empty. Matter of fact it ends up empty, except when using docker buildx bake with very specific inputs that we managed to pin down to a very small, reproducible setup...Expected behaviour
I generally expect to be able to "free up" disk-space consumed by any docker resource through the docker-cli without having to reinstall docker, please let me know if this is somehow misguided.
More specifically after deleting all containers, images, volumes and pruning the build cache, I expect
/var/lib/docker/overlay2
to be empty. (except for the folder calledl
.) To "empty" docker, we typically useddocker system prune -a -f --volumes
,docker builder prune
,docker buildx prune
.Actual behaviour
When using the dockerfiles and docker-bake.hcl provided below, buildx produces files in
/var/lib/docker/overlay2
which we seem to have no way of deleting through the cli and which are also not counted when runningdocker system df
.We have reduced our original dockerfiles and docker-bake.hcl as far as we could until simplifying further makes the problem disappear. Whenever we made any modification we "reset" our docker installation by uninstalling, removing
/var/lib/docker
and reinstalling.The steps below were reproducible on two different machines:
Step1: Make sure your docker setup is "empty"
Step 2: Create dockerfiles and docker-bake.hcl
In a directory of your choice, create the files I have provided in section "Configuration".
Step 3: Build the docker images with docker buildx bake
Step 4: Checking disk usage of docker and /var/lib/docker/overlay2:
We are not running any containers at the moment.
mount
shows no bind mounts inoverlay2
.Step 5: Prune docker
Notice that less than the "reclaimable" amount is reclaimed.
And the builder cache pretends to be empty!
Step 6: Check disk usage again
Docker system, as expected shows 0B being used:
Other docker commands also show no resources:
We are still not running any containers at the moment.
mount
shows no bind mounts inoverlay2
.But when looking at
overlay2
, 1.7GB disk are being used.I have played around with this setup a little more (changed FROM and RUN commands, etc.) Whenever something made the issue disappear, I left a comment in the dockerfile or docker-bake.hcl.
Why I believe it is a problem with
bake
...When using:
docker buildx build -t child -f child.dockerfile .
anddocker buildx build -t parent -f parent.dockerfile .
to build these images instead ofbake
and then pruning, no files are left behind inoverlay2
!Buildx seems to 'know' about these files...
Another interesting observation is that when I remove these folders without also reinstalling docker and then try to build again, the build fails because the directories are missing! So it seems that buildx is somehow aware of these files, it just doesn't prune them! And they are also not counted in
system df
...Buildx version
github.com/docker/buildx 0.11.2 9872040, github.com/docker/buildx v0.11.2 9872040
Docker info
Builders list
Configuration
./parent.dockerfile
./child.dockerfile
./docker-bake.hcl
Build logs
Additional info
No response
The text was updated successfully, but these errors were encountered: