Docker Desktop (Mac) ignoring the disk usage limit I specified in Settings > Resources

Hi all, having a strange issue with Docker Desktop on my Mac mini m1. I searched the entire forum and didn’t find it an answer so maybe it’s just me.
Summary:

  • In docker desktop for Mac under Settings > Resources > Disk Usage Limit, I set this disk limit to be 8GB for the virtual machine. Then I shut down Docker.
  • I then ran sudo rm on my Docker.raw file which was 34GB to delete it.
  • I ran docker compose up -d to get everything back, expecting my new Docker.raw file to be 8GB.
  • Once everything finishes reinstalling, I check and the recreated file is still 34GB – AND at the bottom bar of Docker Desktop it says “Disk: 5.85GB used (limit: 31.32GB).”
  • purging/pruning does nothing, I’ve already tried that and it says there is nothing to reclaim

Also note: when I run docker system df it tells me I have 4.605GB of images, 18.03MB for containers, 0B for local volumes or build cache. Each is 0% reclaimable.

Questions:

  1. Why is docker desktop ignoring the 8GB limit I set in the “Resources” settings page? The bar at the bottom screen seems to think it has 32GB available even though I set this to 8GB.
  2. Why is my Docker.raw file being rebuilt back into a 32GB file and how can I prevent this?

Thank you all

Edit: Apologies, I am new to the forum. Covering the recommended info below

  • Issue type: Docker Desktop Mac - resource allocation limit not working; unnecessarily large docker.raw file
  • OS Version/build: Mac - Sequoia 15.4.1
  • App version: Docker - v4.40.0 (187762) ; everything built out via docker compose and bind mounts which means it’s no problem to delete docker.raw and rebuild everything.
  • Steps to reproduce: (1) lower disk resource limit in settings to 8GB (2) delete Docker.raw (3) reopen Docker Desktop, disk limit in the lower status bar still says 32GB, Docker.raw file is back and taking up 34GB.

I couldn’t even go below 64G, and it turned out it was because I used the beta Docker VMM for the virtualization. When I changed it back to the Apple virtualization framework, I was able to set the size to 8 G and the disk image file was resized to the right size.

Since I thought Docker Desktop should not allow us to change the size to an invalid size, I reported it in an internal channel and I was just informed that it will be fixed in Docker Desktop 4.42. I still have to test it to see how it was fixed exactly.

Thanks for the report.

update:

I could test a nightly build and I can confirm. 4.42 will be able to decrease the disk image size to 8GB even when you are using Docker VMM.

1 Like

Thank you @rimelek! I look forward to trying out the 4.42 release–I will update this post if that fixes it. For now I have downgraded to 4.37.2 which seemed to work.

FWIW, I have always used Apple virtualization framework, and I was still seeing the issue on v4.40.0