microsoft / nav-docker

Official Microsoft repository for Dynamics NAV in Docker resources. It has not been decided yet, to which extend Microsoft will ship Docker images with NAV, so everything in this repo is work in progress and might be subject to deletion.
MIT License
180 stars 91 forks source link

Question: Prevent WindowsFilter taking so much space #558

Open f4n0 opened 3 months ago

f4n0 commented 3 months ago

Hi, Usually, I create a lot of BC containers, but they are deleted frequently (with also system prune, etc.) Now, my question is this: Docker tries to reuse the layer that already has, why does it seem that he always uses something new each time?

Right now the windowsfilter folder is at 100 Gb. and it keeps getting larger and I have only 2 containers! Is there a generic, plain and simple base image that BcContainerHelper can use (that works with the majority of Win Updates) that is also not so big?

rdebath commented 3 months ago

For me BC is running at about 10Gb/image, however, the Microsoft versions of docker seem to have a habit of losing layers. Have a look at the script Find-OrphanDockerLayers.ps1, it cross-references the windowsfilter directory with defined images and containers and (optionally) marks bad ones for deletion. The docker daemon will delete about 5-6 marked layers each time it shuts down (You may need to restart it several times).

BTW: Windows containers cannot use most versions of windows as a guest. The Guest normally has to match the host pretty closely. This even applies to "HyperV" isolation though at least that tends to work for more. Neither mode is even close to the compatibility you get with Linux (if it were you'd be able to run Windows-XP in a container).

f4n0 commented 3 months ago

nice script, I will check this out, but it would be nice if I do not have to do it manually

freddydk commented 3 months ago

Thanks @rdebath - yeah Windows on Docker isn't as good as Linux on Docker. Never saw this script before - I usually run this script: https://github.com/microsoft/nav-arm-templates/blob/master/CleanupAfterDocker.ps1 - which cleans up everything - and then I start from scratch.