ArcherPoint Dynamics NAV / Business Central Developer Digest - Vol 335
In this edition of Developer Digest, we learn the definition of a VS Code Workspace, how to extract event logs from Docker using PowerShell, and the importance of keeping code ready for future releases.
The Dynamics NAV and Business Central community, including the ArcherPoint technical staff, is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of sharing helpful information with one another to help customers be more successful.
As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media...so everyone can benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share this great information with everyone who might not have the time to check out the multitude of resources out there? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV/BC experts and devotees around the world. We hope these insights will benefit you, too.
Addressing Issues with Disk Space Using Docker for Windows
Len has a situation: “Concerning Docker, here is an interesting situation. I don't know if anyone runs into issues of space on their computer. I am still using a 4-year-old computer with 16 gb RAM and 500 gb hard drive. You can remove those containers, you can do a factory reset, but still it seems like your computer is low on space. If you don't know, there is a folder in ProgramData (Not Program Files), that is C:\ProgramData\Docker\windowsfilter. This folder hogs a lot of space. You can go online and see what it is used for, but my latest version of Docker for Windows 10 does have an issue with clearing this folder.
Now, I have not upgraded to 20H2 yet, so I am not sure what the latest version of Docker Desktop does with that version of Windows installed, but I was down to 6 gb on my machine with no way to create more containers. I ran my infamous Docker system prune -a and I tried -af, but that only does so much since this windowsfilter folder does not get cleared. I deleted all my containers and only gained about 20 gb. So, I tried deleting information in this windowsfilter folder, but to no avail; it says you can't. I tried everything without uninstalling and reinstalling docker desktop.
I looked online, and everyone mentions that same fact and say there is a tool called docker-ci-zap you could run to remove that folder, but I didn't want to go that route if I didn't need to. So, I went to the Settings of Docker Desktop, and there is a new Clean/Purge option. I ran that, and it actually cleared several of those folders out of that windowsfilter folder. I now have 200gb of disk space and about 40 gb left in that windowsfilter folder. So, I reset Docker Desktop by doing a Factory Reset. That didn't do anything more, but at least now I have 200 gb of space to work with and only 40 gb left in that folder. I haven't had this much space in years!
Has anyone run into this or played around with clearing this folder on their system? Thoughts?”
Kyle responds: “For space, I would do these things:
Remove-bccontainer on all containers
Remove all images (docker image rm)
Remove all artifacts (Flush-ContainerHelperCache -cache bcartifacts)
Uninstall all versions of bccontainerhelper
Uninstall all version of navcontainerhelper
Then build everything back up, except now you won't have a whole ton of stale versions of everything. For maintenance, I just do the minimum about once a month:
Remove all images
Remove all artifacts
Uninstall all versions of bccontainerhelper
Len adds: “Yes, I do all this already, I usually redo my containers every two weeks. But that windowsfilter folder never decreases in size with any of what you mentioned. So, I was wondering if anyone else has that same problem?”
Kyle returns with: “Ah, yes, windowsfilter. I think that directory is actually a lie. I think this is where, if you are using process isolation, Docker puts a whole ton of files links. They aren't actually files, just links—pointers to the real files in your c:\windows directory. I'm not sure what it does if your container doesn't have the exact same build as the host, but I think it does a best guess at creating those links. You do a directory to see how much space is used, and it is misleading because explorer will go sum up the actual files, not just the links.
Having said all of that, I have no idea how or when docker cleans that up. I would expect that if I removed every image and then de-installed docker that it would completely clear all of that out. I would also think that removing an image would clean up the specific docker layers that are represented in windowslinks. Remove unused images should result in cleaning that up. But those are just educated guesses.”
Ian adds: “This brings back (bad) memories. Docker destroyed my storage on my laptop for almost a year until I figured out what was wrong. I think at one point the C drive was almost completely full. Log.0.txt was almost 200GB!!! I deleted that sucker, and life was good again. I've also upgraded Docker, so I haven't seen the problem reoccur yet.”
Figure 1 – Deleting Log.0.txt from Docker to free up disk space
Suresh advises: “Please check this article from Robert Bird for General Tips and Tricks for Docker for Windows."
If you are interested in Dynamics NAV and Business Central development, be sure to see our collection of NAV/BC Development Blogs.
Read the "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.