Where is containers data stored?

Hello!

I have Docker Desktop for Windows, Docker Engine v19.03.8.

I launched the container based on mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-18.0 image
I created a database and populated it with data. Execute command: docker system df -v and see 177Mb of container space usage. Checked size of C:\ProgramData\DockerDesktop\vm-data\DockerDesktop.vhdx - 9 736 028 160 bytes

Cleaned the database. docker system df -v showing me 110Mb of container space usage. Checked size of C:\ProgramData\DockerDesktop\vm-data\DockerDesktop.vhdx - 9 736 028 160 bytes (size absolutely has not changed).

My questions is: where is containers data physically stored or where did 67 megabytes go?

1 Like

A virtual hard disk doesn’t shrink by itself. You have to open the Hyper-V Manager, go to the Virtual Hard Disk Manager, open this disk and choose ‘Compact’.

tekki, i.e. container data stored exactly on this virtual drive, right?

Unfortunately, I cannot find ‘compact’ function in my Hyper-V Manager (Version: 10.0.17763.1).

Could you tell me where exactly this can be done?

You go one step too far, just open the Hyper-V Manager, then click on Edit Disk... (I use the German version, had to look it up in screenshots). Maybe it’s not a bad idea to make a backup of important data before this.

I can’t find ‘compact’ option. Am I looking for in wrong place or it really missing in my version?

Full big screenshot:

What do you see when you continue until you have chosen the disk?
Take care, a VM is still running on your system.

1 Like

tekki, please click on link after ‘Full big screenshot’ in post above (there I took a screenshot of the whole process).

Sorry, didn’t see that there are more screenshots.
Did you stop Docker before this? When I open DockerDesktop.vhdx in my Hyper-V Manager I have 3 options.

1 Like

When I turned off Docker, ‘Compact’ menu item appeared.But what I expected did not happen.Even vice versa. What I did:

  1. Checked the size of DockerDesktop.vhdx: 9.52 GB;
  2. Added to DB ~50 000 rows. Checked the size of the database: 50.88 Mb;
  3. Shrinked the database, checked size: 18 Mb
  4. Checked the size of DockerDesktop.vhdx: 9.58 GB;
  5. Performed ‘Compact’ for DockerDesktop.vhdx;
  6. Checked the size of DockerDesktop.vhdx: 9.67 GB.

Why is disk size only increasing (and disproportionately)?

This must be a Redmond Riddle.
A general question: Is the size of this volume an actual problem and can’t you wait until you get Windows 10 2004 where you can run Docker in WSL2?

Sorry, but I didn’t understand what you meant here

This is not a big problem for me in this case. I just wanted to understand more deeply how docker works.

Just a joke without an emoji.

Hyper-V is the Windows hypervisor (and Microsoft is located at Redmond, you understand the joke now?). It is used by Docker Desktop to create an environment where Docker can run and it’s not a part of Docker. Some years ago Virtualbox was at this place and with the most recent version you can use WSL2.

Now it is clear. My level of English does not always allow me to understand the essence of what is written, so there is a certain difficulty with jokes too :crying_cat_face:
Thank you for the answers!